support http-client-0.5
This commit is contained in:
parent
a7a3294752
commit
d45c7c5897
2 changed files with 10 additions and 5 deletions
|
@ -42,8 +42,8 @@ library
|
|||
, bytestring >= 0.10 && < 0.11
|
||||
, exceptions >= 0.8 && < 0.9
|
||||
, http-api-data >= 0.1 && < 0.3
|
||||
, http-client >= 0.4.18.1 && < 0.5
|
||||
, http-client-tls >= 0.2.2 && < 0.3
|
||||
, http-client >= 0.4.18.1 && < 0.6
|
||||
, http-client-tls >= 0.2.2 && < 0.4
|
||||
, http-media >= 0.6.2 && < 0.7
|
||||
, http-types >= 0.8.6 && < 0.10
|
||||
, network-uri >= 2.6 && < 2.7
|
||||
|
|
|
@ -147,9 +147,8 @@ performRequest :: Method -> Req -> Manager -> BaseUrl
|
|||
performRequest reqMethod req manager reqHost = do
|
||||
partialRequest <- liftIO $ reqToRequest req reqHost
|
||||
|
||||
let request = partialRequest { Client.method = reqMethod
|
||||
, checkStatus = \ _status _headers _cookies -> Nothing
|
||||
}
|
||||
let request = disableStatusCheck $
|
||||
partialRequest { Client.method = reqMethod }
|
||||
|
||||
eResponse <- liftIO $ catchConnectionError $ Client.httpLbs request manager
|
||||
case eResponse of
|
||||
|
@ -170,6 +169,12 @@ performRequest reqMethod req manager reqHost = do
|
|||
throwE $ FailureResponse status ct body
|
||||
return (status_code, body, ct, hdrs, response)
|
||||
|
||||
disableStatusCheck :: Request -> Request
|
||||
#if MIN_VERSION_http_client(0,5,0)
|
||||
disableStatusCheck req = req { checkResponse = \ _req _res -> return () }
|
||||
#else
|
||||
disableStatusCheck req = req { checkStatus = \ _status _headers _cookies -> Nothing }
|
||||
#endif
|
||||
|
||||
performRequestCT :: MimeUnrender ct result =>
|
||||
Proxy ct -> Method -> Req -> Manager -> BaseUrl
|
||||
|
|
Loading…
Reference in a new issue