Skip to content

Commit

Permalink
Add compatibility for http-client < 0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mbg committed Mar 21, 2022
1 parent 189f606 commit 458a9a3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Docker/Client/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ getEndpointContentType :: Endpoint -> BSC.ByteString
getEndpointContentType (BuildImageEndpoint _ _) = BSC.pack "application/tar"
getEndpointContentType _ = BSC.pack "application/json; charset=utf-8"

getEndpointTimeout :: Endpoint -> HTTP.ResponseTimeout
#if MIN_VERSION_http_client(0,5,0)
getEndpointTimeout :: Endpoint -> HTTP.ResponseTimeout
getEndpointTimeout (WaitContainerEndpoint _) = HTTP.responseTimeoutNone
getEndpointTimeout _ = HTTP.responseTimeoutDefault
#else
-- Prior to version 0.5.0 of `http-client`, `ResponseTimeout` does not exist
-- and we can't easily say "use the manager setting" here. So this is a bit
-- ugly and only exists for the sake of backwards compatibility.
getEndpointTimeout :: Endpoint -> Maybe Int
getEndpointTimeout (WaitContainerEndpoint _) = Nothing
getEndpointTimeout _ = Just 30000000
#endif

0 comments on commit 458a9a3

Please sign in to comment.