git.iko.soy/typeable/servant
on master help sign in
servant-client-ghcjs: Fixed not throwing FailureResponse
911be50Falco Peijnenburg
servant-client-ghcjs/src/Servant/Client/Internal/XhrClient.hs+7−1
@@ -89,7 +89,13 @@ performRequest req = do
89 xhr <- liftIO initXhr
89 xhr <- liftIO initXhr
90 burl <- asks baseUrl
90 burl <- asks baseUrl
91 liftIO $ performXhr xhr burl req
91 liftIO $ performXhr xhr burl req
92− toResponse xhr
92+ resp <- toResponse xhr
93+
94+ let status = statusCode (responseStatusCode resp)
95+ unless (status >= 200 && status < 300) $
96+ throwError $ FailureResponse resp
97+
98+ pure resp
93
99
94-- * initialization
100-- * initialization
95
101