Kadabra.Stream.Response (Kadabra v0.6.0) View Source

Response struct returned from open streams.

If received as a push promise, :status and :body will most likely be empty.

Sample response for a PUT request

%Kadabra.Stream.Response{
  body: "SAMPLE ECHO REQUEST",
  headers: [
    {":status", "200"},
    {"content-type", "text/plain; charset=utf-8"},
    {"date", "Sun, 16 Oct 2016 21:28:15 GMT"}
  ],
  id: 1,
  status: 200
}

Link to this section Summary

Functions

Fetches header with given name.

Link to this section Types

Specs

t() :: %Kadabra.Stream.Response{
  body: String.t(),
  headers: Keyword.t(),
  id: non_neg_integer(),
  status: integer()
}

Link to this section Functions

Link to this function

get_header(headers, header)

View Source

Specs

get_header([...], String.t()) :: {String.t(), term()} | nil

Fetches header with given name.

Examples

iex> stream = %Kadabra.Stream.Response{headers: [{":status", "200"}]}
iex> Kadabra.Stream.Response.get_header(stream.headers, ":status")
{":status", "200"}