servant-client-ghcjs: Fixed not throwing FailureResponse
commit911be50df29ea469fd07409e99df3675c764c7e5
authorFalco Peijnenburg <falco@lumiguide.nl>
dateSun 8 Oct 2017, 19:47 (9 years ago)
parent74bde0a
servant-client-ghcjs/src/Servant/Client/Internal/XhrClient.hs+7−1
@@ -89,7 +89,13 @@ performRequest req = do
8989 xhr <- liftIO initXhr
9090 burl <- asks baseUrl
9191 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
9399
94100-- * initialization
95101