raxx v0.10.5 Raxx.Connection
Manipulate connection header on raxx messages
Summary
Functions
Read connection of the HTTP message
Test if a Connection is marked as reuseable
Keep alive the connection for more messages
Set the connection of a HTTP message
Functions
Read connection of the HTTP message.
Examples
iex> %Raxx.Request{headers: [{"connection", "close"}]} |> Raxx.Connection.fetch
{:ok, "close"}
iex> %Raxx.Request{headers: []} |> Raxx.Connection.fetch
{:error, :field_value_not_specified}
Test if a Connection is marked as reuseable
This behaviour depends if the HTTP version is 1.0 or 1.1.
TODO add a version field to the request/response types.
Assumes 1.1
Examples
iex> %Raxx.Request{headers: [{"connection", "close"}]} |> Raxx.Connection.is_persistant?
false
iex> %Raxx.Request{headers: []} |> Raxx.Connection.is_persistant?
true
Keep alive the connection for more messages.
Examples
iex> %Raxx.Response{} |> Raxx.Connection.mark_persistant() |> Raxx.Connection.fetch()
{:ok, "keep-alive"}