# `Loopback.HTTPRequest`
[🔗](https://github.com/stefanchrobot/loopback/blob/v0.1.0/lib/loopback/http_request.ex#L1)

An intercepted HTTP request, as received by the fakes.

## Fields

  * `:method` - the method in uppercase, like `"GET"`.
  * `:url` - the full URL, including the query string.
  * `:headers` - a list of `{name, value}` tuples of strings, with names in lowercase.
    Defaults to `[]`.
  * `:body` - the body as a binary, or `nil` when there's none. A body streamed by the
    client arrives whole. Defaults to `nil`.

# `t`

```elixir
@type t() :: %Loopback.HTTPRequest{
  body: binary() | nil,
  headers: [{String.t(), String.t()}],
  method: String.t(),
  url: String.t()
}
```

An intercepted HTTP request.

# `new`

```elixir
@spec new(map() | keyword()) :: t()
```

Builds a request from a map or a keyword list of its fields.

Raises `ArgumentError` when `:method` or `:url` is missing.

## Examples

    Loopback.HTTPRequest.new(method: "GET", url: "https://api.example.com/users")

---

*Consult [api-reference.md](api-reference.md) for complete listing*
