Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Network/HTTP/Req.hs
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ reqHandler consume request manager = do
)
)
(preview, r') <- grabPreview httpConfigBodyPreviewLength r
httpConfigLogResponse request r' preview
mapM_ LI.throwHttp (httpConfigCheckResponse request r' preview)
consume r'
)
Expand Down Expand Up @@ -688,6 +689,15 @@ data HttpConfig = HttpConfig
L.Response b ->
ByteString ->
Maybe L.HttpExceptionContent,

-- | Function to log incoming responses
-- Useful for debugging and other stuff.
httpConfigLogResponse ::
forall b.
L.Request ->
L.Response b ->
ByteString ->
IO (),
-- | The retry policy to use for request retrying. By default 'def' is
-- used (see 'RetryPolicyM').
--
Expand Down Expand Up @@ -732,6 +742,7 @@ defaultHttpConfig =
in if 200 <= scode && scode < 300
then Nothing
else Just (L.StatusCodeException (void response) preview),
httpConfigLogResponse = \_ _ _ -> pure (),
httpConfigRetryPolicy = retryPolicyDefault,
httpConfigRetryJudge = \_ response ->
statusCode response
Expand Down