Skip to content

Commit 2507d96

Browse files
Merge pull request #21 from brminnick/Replace-Newtonsoft.JSON-with-System.Text.JSON
Replace Newtonsoft.JSON with System.Text.JSON
2 parents 0862784 + fb95cf1 commit 2507d96

4 files changed

Lines changed: 14 additions & 19 deletions

File tree

Src/GitHubApiStatus.Extensions/GitHubApiStatus.Extensions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ New In This Release:
3131
- Add Support for Microsoft.Extensions.DependencyInjection
3232
- Implements Microsoft.Extensions.Http
3333
</PackageReleaseNotes>
34-
<Version>2.0.0</Version>
34+
<Version>2.0.1</Version>
3535
<RepositoryUrl>https://github.com/brminnick/GitHubApiStatus</RepositoryUrl>
3636
<Product>$(AssemblyName) ($(TargetFramework))</Product>
3737
<AssemblyVersion>1.0.0.0</AssemblyVersion>

Src/GitHubApiStatus/GitHubApiStatus.csproj

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,9 @@ Calculate the GitHub API Rate Limits for the following GitHub APIs
4040
</Description>
4141
<PackageReleaseNotes>
4242
New In This Release:
43-
- Added Interfaces: IGitHubApiStatusService, IGitHubApiRateLimitResponse, IGitHubApiRateLimits and IRateLimitStatus
44-
- Added GitHubApiClient
45-
- Added GitHubApiStatusService.AddProductHeaderValue()
46-
- Added GitHubApiStatusService.SetAuthenticationHeaderValue()
47-
- Added GitHubApiStatusService.IsProductHeaderValueValid
48-
- Added GitHubApiStatusService.IsAuthenticationHeaderValueSet
49-
- Added HttpResponseHeaders Extensions
50-
- Breaking Change: Removed GitHubApiStatusService.Instance
51-
- Breaking Change: Changed GitHubApiStatusService.IsAuthenticated to GitHubApiStatusService.IsResponseFromAuthenticatedRequest
43+
- Use System.Text.Json for .NET Standard 2.0
5244
</PackageReleaseNotes>
53-
<Version>2.0.0</Version>
45+
<Version>2.0.1</Version>
5446
<RepositoryUrl>https://github.com/brminnick/GitHubApiStatus</RepositoryUrl>
5547
<Product>$(AssemblyName) ($(TargetFramework))</Product>
5648
<AssemblyVersion>1.0.0.0</AssemblyVersion>
@@ -99,9 +91,9 @@ New In This Release:
9991
<ItemGroup Condition=" '$(Configuration)'=='Release' ">
10092
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
10193
</ItemGroup>
102-
<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard')) ">
103-
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
94+
<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard1.3')) ">
10495
<PackageReference Update="NETStandard.Library" PrivateAssets="all" />
96+
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
10597
</ItemGroup>
10698
<ItemGroup Condition=" $(TargetFramework.StartsWith('net5')) ">
10799
</ItemGroup>
@@ -111,4 +103,7 @@ New In This Release:
111103
<Folder Include="Services\" />
112104
<Folder Include="Interfaces\" />
113105
</ItemGroup>
106+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
107+
<PackageReference Include="System.Text.Json" Version="4.6.0" />
108+
</ItemGroup>
114109
</Project>

Src/GitHubApiStatus/Models/GitHubApiRateLimitsMutable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if !NETSTANDARD
1+
#if !NETSTANDARD1_3
22
using System;
33
using System.Text.Json.Serialization;
44

Src/GitHubApiStatus/Services/GitHubApiStatusService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Threading.Tasks;
66
using System.Net.Http;
77

8-
#if NETSTANDARD
8+
#if NETSTANDARD1_3
99
using System.IO;
1010
using Newtonsoft.Json;
1111
#else
@@ -36,7 +36,7 @@ public class GitHubApiStatusService : IGitHubApiStatusService
3636
/// </summary>
3737
public const string RateLimitRemainingHeader = "X-RateLimit-Remaining";
3838

39-
#if NETSTANDARD
39+
#if NETSTANDARD1_3
4040
readonly static Lazy<JsonSerializer> _serializerHolder = new(() => new JsonSerializer());
4141
#endif
4242

@@ -118,7 +118,7 @@ public bool IsAuthenticationHeaderValueSet
118118
}
119119
}
120120

121-
#if NETSTANDARD
121+
#if NETSTANDARD1_3
122122
static JsonSerializer Serializer => _serializerHolder.Value;
123123
#endif
124124

@@ -326,14 +326,14 @@ static async Task<GitHubApiRateLimitResponse> GetGitHubApiRateLimitResponse(Http
326326
using var response = await client.GetAsync("https://api.github.com/rate_limit", cancellationToken).ConfigureAwait(false);
327327
response.EnsureSuccessStatusCode();
328328

329-
#if NET5_0
329+
#if NET
330330
using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
331331
#else
332332
using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
333333
#endif
334334

335335

336-
#if NETSTANDARD
336+
#if NETSTANDARD1_3
337337
using var streamReader = new StreamReader(stream);
338338
using var jsonTextReader = new JsonTextReader(streamReader);
339339

0 commit comments

Comments
 (0)