raxx v0.4.1 Raxx.Response

HTTP responses from a Raxx application are encapsulated in a Raxx.Response struct.

The contents are itemised below:

statusThe HTTP status code for the response: 1xx, 2xx, 3xx, 4xx, 5xx
headersThe response headers as a map: %{"content-type" => ["text/plain"]}
bodyThe response body, by default an empty string.

Summary

Functions

Adds a cookie header to the response, that will expire the cookie with the given key

Returns the header value set on the response object specified by name

Return a Raxx.Response that informs the client that the resouce has been found elsewhere

Adds a set cookie header to the response

Functions

client_error?(map)
expire_cookie(map, key)

Adds a cookie header to the response, that will expire the cookie with the given key.

NOTE: Will not expire session cookies.

get_header(map, header_name)

Returns the header value set on the response object specified by name.

header_lines(headers)
informational?(map)
ok(body \\ "", headers \\ [])
redirect(path, headers \\ %{})

Return a Raxx.Response that informs the client that the resouce has been found elsewhere.

This function sets a Location header as well as sending a redirection page.

redirect?(map)
server_error?(map)
set_cookie(map, key, value, options \\ %{})

Adds a set cookie header to the response.

For options see Raxx.Cookie.Attributes

status_line(int)
success?(map)