Convenience functions for working with HTTP requests as Tasks.
get : { url : String, resolver : Http.Resolver x a } -> Task x a
Create a GET
request.
You can use functions like resolveString
and
resolveJson
to interpret the response in different ways.
post : { url : String, resolver : Http.Resolver x a, body : Http.Body } -> Task x a
Create a POST
request.
resolveString : Http.Resolver Http.Error String
Expect the response body to be a String
.
resolveJson : Json.Decode.Decoder a -> Http.Resolver Http.Error a
Expect the response body to be JSON. Returns a BadBody
error when JSON decoding fails.
resolveWhatever : Http.Resolver Http.Error ()
Expect the response body to be anything, and the ignore it.
customResolver : (String -> Result String a) -> Http.Resolver Http.Error a
Use your own body parsing function to build a resolver.