on master help sign in
support http-client-0.5
commitd45c7c58973a8d59533a153d4ee667f08cb8671d authorSönke Hahn <soenkehahn@gmail.com> dateSat 9 Jul 2016, 13:31 (10 years ago) parenta7a3294
2 files changed+10−5
servant-client/servant-client.cabal+2−2 servant-client/src/Servant/Common/Req.hs+8−3
servant-client/servant-client.cabal+2−2
@@ -42,8 +42,8 @@ library
4242 , bytestring >= 0.10 && < 0.11
4343 , exceptions >= 0.8 && < 0.9
4444 , http-api-data >= 0.1 && < 0.3
45− , http-client >= 0.4.18.1 && < 0.5
46− , http-client-tls >= 0.2.2 && < 0.3
45+ , http-client >= 0.4.18.1 && < 0.6
46+ , http-client-tls >= 0.2.2 && < 0.4
4747 , http-media >= 0.6.2 && < 0.7
4848 , http-types >= 0.8.6 && < 0.10
4949 , network-uri >= 2.6 && < 2.7
servant-client/src/Servant/Common/Req.hs+8−3
@@ -147,9 +147,8 @@ performRequest :: Method -> Req -> Manager -> BaseUrl
147147performRequest reqMethod req manager reqHost = do
148148 partialRequest <- liftIO $ reqToRequest req reqHost
149149
150− let request = partialRequest { Client.method = reqMethod
151− , checkStatus = \ _status _headers _cookies -> Nothing
152− }
150+ let request = disableStatusCheck $
151+ partialRequest { Client.method = reqMethod }
153152
154153 eResponse <- liftIO $ catchConnectionError $ Client.httpLbs request manager
155154 case eResponse of
@@ -170,6 +169,12 @@ performRequest reqMethod req manager reqHost = do
170169 throwE $ FailureResponse status ct body
171170 return (status_code, body, ct, hdrs, response)
172171
172+disableStatusCheck :: Request -> Request
173+#if MIN_VERSION_http_client(0,5,0)
174+disableStatusCheck req = req { checkResponse = \ _req _res -> return () }
175+#else
176+disableStatusCheck req = req { checkStatus = \ _status _headers _cookies -> Nothing }
177+#endif
173178
174179performRequestCT :: MimeUnrender ct result =>
175180 Proxy ct -> Method -> Req -> Manager -> BaseUrl