Skip to content

Commit

Permalink
Merge pull request #13 from aspriddell/update-header-preserving-handler
Browse files Browse the repository at this point in the history
Disable autoredirect on httpclienthandlers
  • Loading branch information
aspriddell authored Jul 14, 2020
2 parents e43c720 + aed8468 commit fe92e58
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ public HeaderPreservingRedirectHandler()
}

public HeaderPreservingRedirectHandler(HttpMessageHandler innerHandler)
: base(innerHandler)
{
if (innerHandler is HttpClientHandler clientHandler)
{
clientHandler.AllowAutoRedirect = false;
InnerHandler = clientHandler;
}
}

protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Expand Down

0 comments on commit fe92e58

Please sign in to comment.