mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Update test for redirect diagnostic.
This commit is contained in:
parent
a3873634b0
commit
593c4b8182
@ -70,7 +70,9 @@ public void should_not_follow_redirects_when_not_in_production(HttpStatusCode st
|
|||||||
{
|
{
|
||||||
var request = new HttpRequest("http://eu.httpbin.org/status/" + (int)statusCode);
|
var request = new HttpRequest("http://eu.httpbin.org/status/" + (int)statusCode);
|
||||||
|
|
||||||
Assert.Throws<Exception>(() => Subject.Get<HttpBinResource>(request));
|
Subject.Get<HttpBinResource>(request);
|
||||||
|
|
||||||
|
ExceptionVerification.ExpectedErrors(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -110,7 +110,7 @@ public HttpResponse Execute(HttpRequest request)
|
|||||||
var response = new HttpResponse(request, new HttpHeader(httpWebResponse.Headers), data, httpWebResponse.StatusCode);
|
var response = new HttpResponse(request, new HttpHeader(httpWebResponse.Headers), data, httpWebResponse.StatusCode);
|
||||||
_logger.Trace("{0} ({1:n0} ms)", response, stopWatch.ElapsedMilliseconds);
|
_logger.Trace("{0} ({1:n0} ms)", response, stopWatch.ElapsedMilliseconds);
|
||||||
|
|
||||||
if (!RuntimeInfoBase.IsProduction &&
|
if (request.AllowAutoRedirect && !RuntimeInfoBase.IsProduction &&
|
||||||
(response.StatusCode == HttpStatusCode.Moved ||
|
(response.StatusCode == HttpStatusCode.Moved ||
|
||||||
response.StatusCode == HttpStatusCode.MovedPermanently ||
|
response.StatusCode == HttpStatusCode.MovedPermanently ||
|
||||||
response.StatusCode == HttpStatusCode.Found))
|
response.StatusCode == HttpStatusCode.Found))
|
||||||
|
Loading…
Reference in New Issue
Block a user