git.iko.soy/typeable/servant-reflex
on master help sign in
Treat HTTP response statuses less than 200 as errors

In particular, browsers seem to use status 0 for errors

commit0c740120f66e329dccd2634ae260ac23c91a2f9b authorKen Micklas <ken.micklas@obsidian.systems> dateTue 6 Mar 2018, 19:22 (9 years ago) parent6593c1c
1 file changed+2−1
src/Servant/Common/Req.hs+2−1
src/Servant/Common/Req.hs+2−1
@@ -380,7 +380,8 @@ evalResponse
380380 -> (tag, XhrResponse)
381381 -> ReqResult tag a
382382evalResponse decode (tag, xhr) =
383− let okStatus = _xhrResponse_status xhr < 400
383+ let status = _xhrResponse_status xhr
384+ okStatus = status >= 200 && status < 400
384385 errMsg = fromMaybe
385386 ("Empty response with error code " <>
386387 T.pack (show $ _xhrResponse_status xhr))