Fix HttpClientTests, Use Servarr HttpBin Mirror

pull/1689/head
Qstick 4 years ago
parent f5e2a447e9
commit 3af96f1863

@ -46,7 +46,7 @@ namespace NzbDrone.Common.Test.Http
TestLogger.Info($"{candidates.Length} TestSites available.");
_httpBinSleep = _httpBinHosts.Length < 2 ? 100 : 10;
_httpBinSleep = _httpBinHosts.Count() < 2 ? 100 : 10;
}
private bool IsTestSiteAvailable(string site)
@ -250,7 +250,7 @@ namespace NzbDrone.Common.Test.Http
[Test]
public void should_throw_on_too_many_redirects()
{
var request = new HttpRequest($"https://{_httpBinHost}/redirect/4");
var request = new HttpRequest($"https://{_httpBinHost}/redirect/6");
request.AllowAutoRedirect = true;
Assert.Throws<WebException>(() => Subject.Get(request));

@ -28,6 +28,8 @@ namespace NzbDrone.Common.Http
public class HttpClient : IHttpClient
{
private const int MaxRedirects = 5;
private readonly Logger _logger;
private readonly IRateLimitService _rateLimitService;
private readonly ICached<CookieContainer> _cookieContainerCache;
@ -70,7 +72,7 @@ namespace NzbDrone.Common.Http
_logger.Trace("Redirected to {0}", request.Url);
if (autoRedirectChain.Count > 3)
if (autoRedirectChain.Count > MaxRedirects)
{
throw new WebException($"Too many automatic redirections were attempted for {autoRedirectChain.Join(" -> ")}", WebExceptionStatus.ProtocolError);
}

Loading…
Cancel
Save