We commonly design APIs that return error messages in the response body together with an error status code. The BadStatus constructor in Http.Error doesn't provide the response body anymore. To access these messages, we're then forced to roll our own error type as suggested by the Elm docs.
To make this work with elm-servant, we need to be able to configure:
The error type for HTTP requests (Http.Error)
The expect-style functions that interpret the response body (Http.expectJson and Http.expectString).
We commonly design APIs that return error messages in the response body together with an error status code. The
BadStatus
constructor inHttp.Error
doesn't provide the response body anymore. To access these messages, we're then forced to roll our own error type as suggested by the Elm docs.To make this work with elm-servant, we need to be able to configure:
Http.Error
)Http.expectJson
andHttp.expectString
).