View Source HTTPSpec.Response (http_spec v2.3.0)
A struct for describing HTTP response.
Summary
Types
Functions
Returns the values of the header specified by name
.
Examples
iex> HTTPSpec.Response.get_header(response, "content-type")
["application/json"]
iex> HTTPSpec.Response.get_header(response, "x-unknown")
[]
Returns the values of the trailer specified by name
.
Examples
iex> HTTPSpec.Response.get_trailer(response, "expires")
["Wed, 21 Oct 2015 07:28:00 GMT"]
iex> HTTPSpec.Response.get_trailer(response, "x-unknown")
[]
@spec new(keyword() | map()) :: {:ok, t()} | {:error, HTTPSpec.ArgumentError.t()}
Creates a response from given options.
The options can be provided as a keyword list or a map.
Examples
HTTPSpec.Response.new(%{
status: 200,
headers: [
{"content-type", "text/html"}
],
body: "<html>...</html>"
})
Bang version of new/1
.