# `Tesla.Env`
[🔗](https://github.com/elixir-tesla/tesla/blob/v1.17.0/lib/tesla/env.ex#L1)

This module defines a `t:Tesla.Env.t/0` struct that stores all data related to request/response.

## Fields

- `:method` - method of request. Example: `:get`
- `:url` - request url. Example: `"https://www.google.com"`
- `:query` - list of query params.
  Example: `[{"param", "value"}]` will be translated to `?params=value`.
  Note: query params passed in url (e.g. `"/get?param=value"`) are not parsed to `query` field.
- `:headers` - list of request/response headers.
  Example: `[{"content-type", "application/json"}]`.
  Note: request headers are overridden by response headers when adapter is called.
- `:body` - request/response body.
  Note: request body is overridden by response body when adapter is called.
- `:status` - response status. Example: `200`
- `:opts` - list of options. Example: `[adapter: [recv_timeout: 30_000]]`
- `:assigns` - a place for user data as a map. It can be used to carry application-specific
  metadata through the middleware pipeline.

- `:private` - a map reserved for libraries and middleware to use. The keys must be atoms.
  Prefix the keys with the name of your project to avoid any future conflicts. The `tesla_`
  prefix is reserved for Tesla.

# `assigns`

```elixir
@type assigns() :: %{optional(atom()) =&gt; any()}
```

# `body`

```elixir
@type body() :: any()
```

# `client`

```elixir
@type client() :: Tesla.Client.t()
```

# `headers`

```elixir
@type headers() :: [{binary(), binary()}]
```

# `method`

```elixir
@type method() :: :head | :get | :delete | :trace | :options | :post | :put | :patch
```

# `opts`

```elixir
@type opts() :: keyword()
```

# `param`

```elixir
@type param() :: binary() | [{binary() | atom(), param()}]
```

# `private`

```elixir
@type private() :: %{optional(atom()) =&gt; any()}
```

# `query`

```elixir
@type query() :: [{binary() | atom(), param()}]
```

# `result`

```elixir
@type result() :: {:ok, t()} | {:error, any()}
```

# `runtime`

```elixir
@type runtime() ::
  {atom(), atom(), any()}
  | {atom(), atom()}
  | {:fn, (t() -&gt; t())}
  | {:fn, (t(), stack() -&gt; t())}
```

# `stack`

```elixir
@type stack() :: [runtime()]
```

# `status`

```elixir
@type status() :: integer() | nil
```

# `t`

```elixir
@type t() :: %Tesla.Env{
  __client__: client() | nil,
  __module__: atom() | nil,
  assigns: assigns(),
  body: body(),
  headers: headers(),
  method: method(),
  opts: opts(),
  private: private(),
  query: query(),
  status: status(),
  url: url()
}
```

# `url`

```elixir
@type url() :: binary()
```

---

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