git.iko.soy/typeable/servant
on master help sign in
Do one atomic update to the cookie jar for all request and responses.
commit8490ccbe933d8d0924550ec45f07688eda3ccda8 authorMichael Dunn <michael@bitnomial.com> dateSat 26 Jan 2019, 22:13 (8 years ago) parentc33f27d
1 file changed+3−2
servant-client/src/Servant/Client/Internal/HttpClient.hs+3−2
servant-client/src/Servant/Client/Internal/HttpClient.hs+3−2
@@ -184,8 +184,9 @@ performRequest req = do
184184 updateWithResponseCookies cj responses = do
185185 now <- getCurrentTime
186186 bss <- Client.brConsume $ Client.responseBody fRes
187− let fRes' = fRes { Client.responseBody = BSL.fromChunks bss }
188− mapM_ (atomically . updateCookieJar now) $ Client.hrRedirects responses <> [(fReq, fRes')]
187+ let fRes' = fRes { Client.responseBody = BSL.fromChunks bss }
188+ allResponses = Client.hrRedirects responses <> [(fReq, fRes')]
189+ atomically $ mapM_ (updateCookieJar now) allResponses
189190 return fRes'
190191 where
191192 updateCookieJar :: UTCTime -> (Client.Request, Client.Response BSL.ByteString) -> STM ()