lukewestby / http-extra / Http.Extra

Convenience functions for working with Http

Types


type NoContent
    = NoContent

A value representing a response that has no content. Like such a response, this value contains no information and has one value.

Expects

expectJsonResponse : Json.Decode.Decoder a -> Http.Expect (Http.Response a)

Decode a response body as JSON, but keep the rest of the response. Unlike Http.expecJson, you can decode using a Decoder but still get access to response headers, status code, etc.

expectValue : a -> Http.Expect a

Complete a request with a predetermined value. Using Json.Decode.succeed fails when the the server doesn't send back valid JSON, as expectJson always attempts to parse the response body as JSON. expectValue skips decoding entirely.

expectNoContent : Http.Expect NoContent

Complete a request with NoContent value. Skips JSON decoding to always complete with NoContent, regardless of what the server returns.