New: Use System.Text.Json for Nancy and SignalR

This commit is contained in:
ta264
2021-02-10 21:52:48 +00:00
parent 16b3817202
commit d3e8c7e0c9
40 changed files with 378 additions and 88 deletions
@@ -51,7 +51,7 @@ namespace NzbDrone.Integration.Test.Client
throw response.ErrorException;
}
AssertDisableCache(response.Headers);
AssertDisableCache(response);
response.ErrorMessage.Should().BeNullOrWhiteSpace();
@@ -68,9 +68,10 @@ namespace NzbDrone.Integration.Test.Client
return Json.Deserialize<T>(content);
}
private static void AssertDisableCache(IList<Parameter> headers)
private static void AssertDisableCache(IRestResponse response)
{
// cache control header gets reordered on net core
var headers = response.Headers;
((string)headers.Single(c => c.Name == "Cache-Control").Value).Split(',').Select(x => x.Trim())
.Should().BeEquivalentTo("no-store, must-revalidate, no-cache, max-age=0".Split(',').Select(x => x.Trim()));
headers.Single(c => c.Name == "Pragma").Value.Should().Be("no-cache");
@@ -28,6 +28,7 @@ using Readarr.Api.V1.Profiles.Quality;
using Readarr.Api.V1.RootFolders;
using Readarr.Api.V1.Tags;
using RestSharp;
using RestSharp.Serializers.SystemTextJson;
namespace NzbDrone.Integration.Test
{
@@ -98,6 +99,7 @@ namespace NzbDrone.Integration.Test
RestClient = new RestClient(RootUrl + "api/v1/");
RestClient.AddDefaultHeader("Authentication", ApiKey);
RestClient.AddDefaultHeader("X-Api-Key", ApiKey);
RestClient.UseSystemTextJson();
Blacklist = new ClientBase<BlacklistResource>(RestClient, ApiKey);
Commands = new CommandClient(RestClient, ApiKey);