This repository has been archived by the owner on Mar 8, 2018. It is now read-only.
Better errors and responses!
Modifies send to accept decoders for both 2xx and non-2xx response bodies.
Adds a custom response type for which send returns a task that looks like:
type alias Response a =
{ data : a
, status : Int
, statusText : String
, headers : Dict String String
, url : String
}
and introduces a new error type which will pass through a Response a in the case of non-2xx results:
type Error a
= Timeout
| UnexpectedPayload String
| NetworkError
| BadRequest (Response a)
This way you get built-in JSON decoding as well as response information for failed requests.