From aed8468e8951f4654a822974c077574fbdee3c18 Mon Sep 17 00:00:00 2001 From: Albie Date: Tue, 14 Jul 2020 15:21:55 +0100 Subject: [PATCH] disable auto redirect as we handle it --- .../Handlers/HeaderPreservingRedirectHandler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DragonFruit.Common.Data/Handlers/HeaderPreservingRedirectHandler.cs b/DragonFruit.Common.Data/Handlers/HeaderPreservingRedirectHandler.cs index 2ddd885..18a8d4d 100644 --- a/DragonFruit.Common.Data/Handlers/HeaderPreservingRedirectHandler.cs +++ b/DragonFruit.Common.Data/Handlers/HeaderPreservingRedirectHandler.cs @@ -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 SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)