Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Polymath to use JsonContent rather than StringContent #332

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/VaultSharp/Core/Polymath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using VaultSharp.V1.Commons;
using System.Text.Json.Nodes;
using System.Text.Json;
using System.Net.Http.Json;

namespace VaultSharp.Core
{
Expand Down Expand Up @@ -199,7 +200,7 @@ public async Task MakeVaultApiRequest(string resourcePath, HttpMethod httpMethod
var requestUri = new Uri(_httpClient.BaseAddress, new Uri(resourcePath, UriKind.Relative));

var requestContent = requestData != null
? new StringContent(JsonSerializer.Serialize(requestData), Encoding.UTF8)
? JsonContent.Create(requestData)
: null;

HttpRequestMessage httpRequestMessage = null;
Expand Down Expand Up @@ -233,7 +234,7 @@ public async Task MakeVaultApiRequest(string resourcePath, HttpMethod httpMethod
httpRequestMessage = new HttpRequestMessage(httpMethod, requestUri)
{
Content = requestData != null
? new StringContent(JsonSerializer.Serialize(requestData), Encoding.UTF8, "application/merge-patch+json")
? JsonContent.Create(requestData, mediaType: new System.Net.Http.Headers.MediaTypeHeaderValue("application/merge-patch+json"))
: null
};

Expand Down
24 changes: 24 additions & 0 deletions src/VaultSharp/VaultSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ This library is built with .NET Standard 2.0, .NET Standard 2.1, 4.6.2, 4.7.2*,
<PackageReference Include="System.Text.Json">
<Version>7.0.2</Version>
</PackageReference>
<PackageReference Include="System.Net.Http.Json">
<Version>7.0.1</Version>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net47'">
Expand All @@ -105,6 +108,9 @@ This library is built with .NET Standard 2.0, .NET Standard 2.1, 4.6.2, 4.7.2*,
<PackageReference Include="System.Text.Json">
<Version>7.0.2</Version>
</PackageReference>
<PackageReference Include="System.Net.Http.Json">
<Version>7.0.1</Version>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net471'">
Expand All @@ -114,6 +120,9 @@ This library is built with .NET Standard 2.0, .NET Standard 2.1, 4.6.2, 4.7.2*,
<PackageReference Include="System.Text.Json">
<Version>7.0.2</Version>
</PackageReference>
<PackageReference Include="System.Net.Http.Json">
<Version>7.0.1</Version>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
Expand All @@ -123,6 +132,9 @@ This library is built with .NET Standard 2.0, .NET Standard 2.1, 4.6.2, 4.7.2*,
<PackageReference Include="System.Text.Json">
<Version>7.0.2</Version>
</PackageReference>
<PackageReference Include="System.Net.Http.Json">
<Version>7.0.1</Version>
</PackageReference>
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net48'">
Expand All @@ -136,6 +148,9 @@ This library is built with .NET Standard 2.0, .NET Standard 2.1, 4.6.2, 4.7.2*,
<PackageReference Include="System.Text.Json">
<Version>7.0.2</Version>
</PackageReference>
<PackageReference Include="System.Net.Http.Json">
<Version>7.0.1</Version>
</PackageReference>
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net481'">
Expand All @@ -149,6 +164,9 @@ This library is built with .NET Standard 2.0, .NET Standard 2.1, 4.6.2, 4.7.2*,
<PackageReference Include="System.Text.Json">
<Version>7.0.2</Version>
</PackageReference>
<PackageReference Include="System.Net.Http.Json">
<Version>7.0.1</Version>
</PackageReference>
</ItemGroup>


Expand All @@ -160,6 +178,9 @@ This library is built with .NET Standard 2.0, .NET Standard 2.1, 4.6.2, 4.7.2*,
<PackageReference Include="System.Text.Json">
<Version>7.0.2</Version>
</PackageReference>
<PackageReference Include="System.Net.Http.Json">
<Version>7.0.1</Version>
</PackageReference>
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
Expand All @@ -170,6 +191,9 @@ This library is built with .NET Standard 2.0, .NET Standard 2.1, 4.6.2, 4.7.2*,
<PackageReference Include="System.Text.Json">
<Version>7.0.2</Version>
</PackageReference>
<PackageReference Include="System.Net.Http.Json">
<Version>7.0.1</Version>
</PackageReference>
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net6.0'">
Expand Down