-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
In the definition of HasMethodClients method r JSON (Aff (Either JSONClientError r))
(here) you are not checking the status code before deciding whether to parse the body of the request:
instance hasMethodClientMethodJson
:: (DecodeJson r, IsSymbol method)
=> HasMethodClients method r JSON (Aff (Either JSONClientError r)) where
getMethodClients method _ req = do
toAffjaxRequest req
# _ { method = toMethod method, responseFormat = AXResponseFormat.json }
# request
# map (bimap RequestError (_.body >>> decodeJson >>> lmap DecodeError) >>> join)
In the event that the networkl request succeeds but the server returns a non 200
response code, you are attempting to parse the body as valid a valid JSON for the type r
, which is probably not what you want to do. IMO the correct implementation would define some kind of client error type in the event of non 200
similar to servant-client
Metadata
Metadata
Assignees
Labels
No labels