An enum that represent all valid HTTP methods.
Config objects allow Requests that uses different URL representations than Strings and different error types than Http.Error.
The default config
Create a simple http request
Represents the expected response in an Http request
Declares a request that expects a JSON response handled with the given decoder.
Declares a request that expects a binary response handled with the given decoder.
Declares a request that expects a simple string response.
Ignores the content of the received response.
Adds a list of headers to the request.
Request.get
{ url = "https://example.com"
, expect = Request.expectJson Json.Decode.string
}
|> Request.withHeaders [ ( "Authorization", "Bearer " ++ token ) ]Ignore specific default headers declared in the config.
Request.get
{ url = "https://example.com"
, expect = Request.expectJson Json.Decode.string
}
|> Request.excludeDefaultHeaders [ "Authorization", "Cookie" ]Ignore all default headers declared in the config.
Request.get
{ url = "https://example.com"
, expect = Request.expectJson Json.Decode.string
}
|> Request.ignoreDefaultHeadersDeclares the request as risky (or not) according to the boolean argument.
Request.get
{ url = "https://example.com"
, expect = Request.expectJson Json.Decode.string
}
|> Request.risky TrueConvert a request to a command.
This function requires a config object. If you don not need one, use the simple
config exported by this package.
Request.get
{ url = "https://example.com"
, expect = Request.expectJson Json.Decode.string
}
|> Request.cmd Request.simple ResponseReceivedConvert a request to a task.
This function requires a config object. If you don not need one, use the simple
config exported by this package.
Request.get
{ url = "https://example.com"
, expect = Request.expectJson Json.Decode.string
}
|> Request.task Request.simple
Represent an HTTP request