Package updates

pull/1323/head
ta264 3 years ago
parent cef15887a4
commit f53a1d7942

@ -2,9 +2,9 @@
<ItemGroup>
<PackageVersion Include="AutoFixture" Version="4.17.0" />
<PackageVersion Include="coverlet.collector" Version="3.0.4-preview.27.ge7cb7c3b40" PrivateAssets="all" />
<PackageVersion Include="Dapper" Version="2.0.90" />
<PackageVersion Include="Dapper" Version="2.0.123" />
<PackageVersion Include="DotNet4.SocksProxy" Version="1.4.0.1" />
<PackageVersion Include="DryIoc.dll" Version="4.8.1" />
<PackageVersion Include="DryIoc.dll" Version="4.8.4" />
<PackageVersion Include="DryIoc.Microsoft.DependencyInjection" Version="5.1.0" />
<PackageVersion Include="Equ" Version="2.3.0" />
<PackageVersion Include="FluentAssertions" Version="5.10.3" />
@ -13,8 +13,8 @@
<PackageVersion Include="FluentValidation" Version="8.6.2" />
<PackageVersion Include="Ical.Net" Version="4.2.0" />
<PackageVersion Include="ImpromptuInterface" Version="7.0.1" />
<PackageVersion Include="Kveer.XmlRPC" Version="1.1.1" />
<PackageVersion Include="Mailkit" Version="2.13.0" />
<PackageVersion Include="Kveer.XmlRPC" Version="1.2.0" />
<PackageVersion Include="Mailkit" Version="2.15.0" />
<PackageVersion Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.8" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
@ -23,29 +23,29 @@
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageVersion Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageVersion Include="Mono.Posix.NETStandard" Version="5.20.1-servarr1" />
<PackageVersion Include="MonoTorrent" Version="2.0.0" />
<PackageVersion Include="MonoTorrent" Version="2.0.1" />
<PackageVersion Include="Moq" Version="4.16.1" />
<PackageVersion Include="NBuilder" Version="6.1.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
<PackageVersion Include="NLog.Extensions.Logging" Version="1.7.3" />
<PackageVersion Include="NLog" Version="4.7.10" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.0.0" />
<PackageVersion Include="NLog.Extensions.Logging" Version="1.7.4" />
<PackageVersion Include="NLog" Version="4.7.12" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.1.0" />
<PackageVersion Include="NUnit" Version="3.13.2" />
<PackageVersion Include="NunitXml.TestLogger" Version="3.0.107" />
<PackageVersion Include="PdfSharpCore" Version="1.2.17" />
<PackageVersion Include="RestSharp.Serializers.SystemTextJson" Version="106.12.0" />
<PackageVersion Include="RestSharp" Version="106.12.0" />
<PackageVersion Include="NunitXml.TestLogger" Version="3.0.117" />
<PackageVersion Include="PdfSharpCore" Version="1.3.9" />
<PackageVersion Include="RestSharp.Serializers.SystemTextJson" Version="106.13.0" />
<PackageVersion Include="RestSharp" Version="106.13.0" />
<PackageVersion Include="Selenium.Support" Version="3.141.0" />
<PackageVersion Include="Selenium.WebDriver.ChromeDriver" Version="91.0.4472.10100" />
<PackageVersion Include="Sentry" Version="3.8.0" />
<PackageVersion Include="SharpZipLib" Version="1.3.2" />
<PackageVersion Include="SixLabors.ImageSharp" Version="1.0.3" />
<PackageVersion Include="Sentry" Version="3.11.1" />
<PackageVersion Include="SharpZipLib" Version="1.3.3" />
<PackageVersion Include="SixLabors.ImageSharp" Version="1.0.4" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.1.118" />
<PackageVersion Include="System.Buffers" Version="4.5.1" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="5.0.0" />
<PackageVersion Include="System.Data.SQLite.Core.Servarr" Version="1.0.115.0-0" />
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="13.2.41" />
<PackageVersion Include="System.IO.Abstractions" Version="13.2.41" />
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="13.2.47" />
<PackageVersion Include="System.IO.Abstractions" Version="13.2.47" />
<PackageVersion Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
<PackageVersion Include="System.Memory" Version="4.5.4" />
<PackageVersion Include="System.Reflection.TypeExtensions" Version="4.7.0" />

@ -151,6 +151,20 @@ namespace NzbDrone.Common.Test.Http
response.Resource.Data.Should().Be(message);
}
[Test]
public void should_execute_post_with_content_type()
{
var message = "{ my: 1 }";
var request = new HttpRequest($"https://{_httpBinHost}/post");
request.SetContent(message);
request.Headers.ContentType = "application/json";
var response = Subject.Post<HttpBinResource>(request);
response.Resource.Data.Should().Be(message);
}
[Test]
public void should_execute_get_using_gzip()
{

@ -78,6 +78,11 @@ namespace NzbDrone.Common.Http.Dispatchers
cts.CancelAfter(TimeSpan.FromSeconds(100));
}
if (request.ContentData != null)
{
requestMessage.Content = new ByteArrayContent(request.ContentData);
}
if (request.Headers != null)
{
AddRequestHeaders(requestMessage, request.Headers);
@ -89,18 +94,6 @@ namespace NzbDrone.Common.Http.Dispatchers
try
{
if (request.ContentData != null)
{
var content = new ByteArrayContent(request.ContentData);
content.Headers.Remove("Content-Type");
if (request.Headers.ContentType.IsNotNullOrWhiteSpace())
{
content.Headers.Add("Content-Type", request.Headers.ContentType);
}
requestMessage.Content = content;
}
responseMessage = httpClient.Send(requestMessage, cts.Token);
}
catch (HttpRequestException e)
@ -185,11 +178,10 @@ namespace NzbDrone.Common.Http.Dispatchers
webRequest.Headers.Connection.Add(header.Value);
break;
case "Content-Length":
webRequest.Headers.Add("Content-Length", header.Value);
AddContentHeader(webRequest, "Content-Length", header.Value);
break;
case "Content-Type":
webRequest.Headers.Remove("Content-Type");
webRequest.Headers.Add("Content-Type", header.Value);
AddContentHeader(webRequest, "Content-Type", header.Value);
break;
case "Date":
webRequest.Headers.Remove("Date");
@ -222,6 +214,18 @@ namespace NzbDrone.Common.Http.Dispatchers
}
}
private void AddContentHeader(HttpRequestMessage request, string header, string value)
{
var headers = request.Content?.Headers;
if (headers == null)
{
return;
}
headers.Remove(header);
headers.Add(header, value);
}
private CredentialCache GetCredentialCache()
{
return _credentialCache.Get("credentialCache", () => new CredentialCache());

Loading…
Cancel
Save