git.iko.soy/typeable/servant
on master help sign in
support http-client-0.5
d45c7c5Sönke Hahn
servant-client/servant-client.cabal+2−2
@@ -42,8 +42,8 @@ library
42 , bytestring >= 0.10 && < 0.11
42 , bytestring >= 0.10 && < 0.11
43 , exceptions >= 0.8 && < 0.9
43 , exceptions >= 0.8 && < 0.9
44 , http-api-data >= 0.1 && < 0.3
44 , http-api-data >= 0.1 && < 0.3
45− , http-client >= 0.4.18.1 && < 0.5
45+ , http-client >= 0.4.18.1 && < 0.6
46− , http-client-tls >= 0.2.2 && < 0.3
46+ , http-client-tls >= 0.2.2 && < 0.4
47 , http-media >= 0.6.2 && < 0.7
47 , http-media >= 0.6.2 && < 0.7
48 , http-types >= 0.8.6 && < 0.10
48 , http-types >= 0.8.6 && < 0.10
49 , network-uri >= 2.6 && < 2.7
49 , network-uri >= 2.6 && < 2.7
servant-client/src/Servant/Common/Req.hs+8−3
@@ -147,9 +147,8 @@ performRequest :: Method -> Req -> Manager -> BaseUrl
147performRequest reqMethod req manager reqHost = do
147performRequest reqMethod req manager reqHost = do
148 partialRequest <- liftIO $ reqToRequest req reqHost
148 partialRequest <- liftIO $ reqToRequest req reqHost
149
149
150+ let request = disableStatusCheck $
150− let request = partialRequest { Client.method = reqMethod
151+ partialRequest { Client.method = reqMethod }
151− , checkStatus = \ _status _headers _cookies -> Nothing
152− }
153
152
154 eResponse <- liftIO $ catchConnectionError $ Client.httpLbs request manager
153 eResponse <- liftIO $ catchConnectionError $ Client.httpLbs request manager
155 case eResponse of
154 case eResponse of
@@ -170,6 +169,12 @@ performRequest reqMethod req manager reqHost = do
170 throwE $ FailureResponse status ct body
169 throwE $ FailureResponse status ct body
171 return (status_code, body, ct, hdrs, response)
170 return (status_code, body, ct, hdrs, response)
172
171
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
173
178
174performRequestCT :: MimeUnrender ct result =>
179performRequestCT :: MimeUnrender ct result =>
175 Proxy ct -> Method -> Req -> Manager -> BaseUrl
180 Proxy ct -> Method -> Req -> Manager -> BaseUrl