HTTPipe v0.9.0 HTTPipe.Response
An HTTP response from a server.
Summary
Types
The body returned by the server
Headers returned by the server are stored in a map of header names (in
lower case) to their values. The names and values are always of the type
String.t
The status code returned by the server
Encapsulates an HTTP response
Functions
Returns the value of the requested header, returning the default value if the header does not exist
Inspects the structure of the Response struct passed in the same
way IO.inspect/1
might, returning the Response struct so that it
can be used easily with pipes
Types
body :: String.t
The body returned by the server.
This will always be a string, even if it is empty. While a server may return different content types, they will always be string encoded and further processing must be done to decode them into a target format.
headers :: %{required(String.t) => String.t}
Headers returned by the server are stored in a map of header names (in
lower case) to their values. The names and values are always of the type
String.t
.
status_code :: 100..599
The status code returned by the server.
Valid status codes are considered to be in the range 100 to 599 (inclusive), but the actual range used by HTTP servers is commonly a smaller subset of that range. See this site for more reference on individual status codes.
t :: %HTTPipe.Response{body: body, headers: headers, status_code: status_code}
Encapsulates an HTTP response
:status_code
The status code returned by the server. See the status_code
type.
:body
The body returned by the server. See the body
type.
:headers
The headers returned by the server. See the headers
type.
Functions
Returns the value of the requested header, returning the default value if the header does not exist
Inspects the structure of the Response struct passed in the same
way IO.inspect/1
might, returning the Response struct so that it
can be used easily with pipes.
Typically, Kernel.inspect/1
, IO.inspect/1
, and their companions are
implemented using the Inspect
protocol. However, the presentation used
here can get extremely intrusive when experimenting using IEx, so it’s
relegated to this function. Corresponding functions can be found at
HTTPipe.Conn.inspect/2
and HTTPipe.Request.inspect/2
.
See HTTPipe.InspectionHelpers
for more information