Packages
raxx
0.14.13
1.1.0
1.0.1
1.0.0
1.0.0-rc.3
1.0.0-rc.2
retired
1.0.0-rc.1
retired
1.0.0-rc.0
retired
0.18.1
0.18.0
0.17.6
0.17.5
0.17.4
0.17.3
0.17.2
0.17.1
0.17.0
0.16.1
0.16.0
retired
0.15.11
0.15.10
0.15.9
0.15.8
0.15.7
0.15.6
0.15.5
0.15.4
0.15.3
0.15.2
0.15.1
0.15.0
0.14.14
0.14.13
0.14.12
0.14.11
0.14.10
0.14.9
0.14.8
0.14.7
0.14.6
0.14.5
0.14.4
0.14.3
0.14.2
0.14.1
0.14.0
0.13.0
0.12.3
0.12.2
0.12.1
0.12.0
0.11.1
0.11.0
0.10.5
0.10.4
0.10.3
0.10.2
0.10.1
0.10.0
0.9.0
0.8.2
0.8.1
0.8.0
0.7.1
0.7.0
0.6.0
0.5.2
0.5.1
0.5.0
0.4.3
0.4.2
0.4.1
0.4.0
0.3.0
0.2.0
0.1.0
0.0.1
Interface for HTTP webservers, frameworks and clients.
Current section
Files
Jump to
Current section
Files
lib/raxx/request.ex
defmodule Raxx.Request do
@moduledoc """
HTTP requests to a Raxx application are encapsulated in a `Raxx.Request` struct.
A request has all the properties of the url it was sent to.
In addition it has optional content, in the body.
As well as a variable number of headers that contain meta data.
Where appropriate URI properties are named from this definition.
> scheme:[//[user:password@]host[:port]][/]path[?query][#fragment]
from [wikipedia](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax)
The contents are itemised below:
| **scheme** | `http` or `https`, depending on the transport used. |
| **authority** | The location of the hosting server, as a binary. e.g. `www.example.com`. Plus an optional port number, separated from the hostname by a colon |
| **method** | The HTTP request method, such as “GET” or “POST”, as a binary. This cannot ever be an empty string, and is always uppercase. |
| **mount** | The segments of the request URL's “path”, that have already been matched. Same as rack path_info. This may be an empty array, if the requested URL targets the application root. |
| **path** | The remainder of the request URL's “path”, split into segments. It designates the virtual “location” of the request's target within the application. This may be an empty array, if the requested URL targets the application root. |
| **query** | The query parameters from the URL search string, formatted as a map of strings. |
| **headers** | The headers from the HTTP request as a map of strings. Note all headers will be downcased, e.g. `%{"content-type" => "text/plain"}` |
| **body** | The body content sent with the request |
"""
@typedoc """
Method to indicate the desired action to be performed on the identified resource.
"""
@type method :: atom
@typedoc """
Scheme describing protocol used.
"""
@type scheme :: :http | :https
@typedoc """
Elixir representation for an HTTP request.
"""
@type t :: %__MODULE__{
scheme: scheme,
authority: binary,
method: method,
mount: [binary],
path: [binary],
query: %{binary => binary} | nil,
headers: Raxx.headers(),
body: Raxx.body()
}
defstruct scheme: nil,
authority: nil,
method: nil,
mount: [],
path: [],
query: %{},
headers: [],
body: nil
end