View Source XHTTP.Response protocol (XHTTP v0.1.0)
The Response protocol provides common functions for retrieving data from a HTTP response.
How exactly that data is retrieved is up to the implementation, and the protocol relies on each response consisting of headers and body.
Summary
Types
All the types that implement this protocol.
Functions
Retrieve the last value for a given header.
Checks whether the HTTP response contains the searched header name.
Return an enumerable of headers as {key, value}
pairs.
Retrieve the body in the Response.
Types
@type body() :: nil | binary() | Enumerable.t() | struct()
@type header() :: {key :: header_key(), value :: header_value()}
@type header_value() :: header_value_single() | Enumerable.t(header_value_single())
@type status() :: nil | pos_integer()
@type t() :: term()
All the types that implement this protocol.
Functions
@spec header(response :: t(), header :: String.t(), default :: header_value()) :: header_value()
Retrieve the last value for a given header.
Checks whether the HTTP response contains the searched header name.
@spec headers(response :: t()) :: Enumerable.t(header())
Return an enumerable of headers as {key, value}
pairs.
Retrieve the body in the Response.