diff --git a/src/Flurl.Http/FlurlRequest.cs b/src/Flurl.Http/FlurlRequest.cs index b930ff09..ca4cdd9a 100644 --- a/src/Flurl.Http/FlurlRequest.cs +++ b/src/Flurl.Http/FlurlRequest.cs @@ -161,9 +161,9 @@ private void WriteRequestCookies(HttpRequestMessage request) { } private void ReadResponseCookies(HttpResponseMessage response) { - if (response?.RequestMessage == null) return; - - var uri = response.RequestMessage.RequestUri; + var uri = response?.RequestMessage?.RequestUri; + if (uri == null) + return; // if the handler is an HttpClientHandler (which it usually is), it's already plucked the // cookies out of the headers and put them in the CookieContainer.