From 593c4b8182995134f90ecb4416e4beb729c97f8e Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sun, 15 Mar 2015 02:00:44 +0100 Subject: [PATCH] Update test for redirect diagnostic. --- src/NzbDrone.Common.Test/Http/HttpClientFixture.cs | 4 +++- src/NzbDrone.Common/Http/HttpClient.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs index 8673dae16..0b7d0fb9b 100644 --- a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs +++ b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs @@ -70,7 +70,9 @@ namespace NzbDrone.Common.Test.Http { var request = new HttpRequest("http://eu.httpbin.org/status/" + (int)statusCode); - Assert.Throws(() => Subject.Get(request)); + Subject.Get(request); + + ExceptionVerification.ExpectedErrors(1); } [Test] diff --git a/src/NzbDrone.Common/Http/HttpClient.cs b/src/NzbDrone.Common/Http/HttpClient.cs index 8b5c42edd..d5585250b 100644 --- a/src/NzbDrone.Common/Http/HttpClient.cs +++ b/src/NzbDrone.Common/Http/HttpClient.cs @@ -110,7 +110,7 @@ namespace NzbDrone.Common.Http var response = new HttpResponse(request, new HttpHeader(httpWebResponse.Headers), data, httpWebResponse.StatusCode); _logger.Trace("{0} ({1:n0} ms)", response, stopWatch.ElapsedMilliseconds); - if (!RuntimeInfoBase.IsProduction && + if (request.AllowAutoRedirect && !RuntimeInfoBase.IsProduction && (response.StatusCode == HttpStatusCode.Moved || response.StatusCode == HttpStatusCode.MovedPermanently || response.StatusCode == HttpStatusCode.Found))