View Source Finch.Request (Finch v0.14.0)

A request struct.

Link to this section Summary

Types

Optional request body.

Request headers.

An HTTP request method represented as an atom() or a String.t().

t()

A Uniform Resource Locator, the address of a resource on the Web.

Functions

Sets a new private key and value in the request metadata. This storage is meant to be used by libraries and frameworks to inject information about the request that needs to be retrieved later on, for example, from handlers that consume Finch.Telemetry events.

Link to this section Types

@type body() :: iodata() | {:stream, Enumerable.t()} | nil

Optional request body.

@type headers() :: Mint.Types.headers()

Request headers.

@type method() ::
  :get | :post | :head | :patch | :delete | :options | :put | String.t()

An HTTP request method represented as an atom() or a String.t().

The following atom methods are supported: :get, :post, :put, :patch, :delete, :head, :options. You can use any arbitrary method by providing it as a String.t().

@type private_metadata() :: %{optional(atom()) => term()}
@type t() :: %Finch.Request{
  body: body(),
  headers: headers(),
  host: String.t() | nil,
  method: String.t(),
  path: String.t(),
  port: :inet.port_number(),
  private: private_metadata(),
  query: String.t() | nil,
  scheme: Mint.Types.scheme(),
  unix_socket: String.t() | nil
}
@type url() :: String.t() | URI.t()

A Uniform Resource Locator, the address of a resource on the Web.

Link to this section Functions

Link to this function

put_private(request, key, value)

View Source
@spec put_private(t(), key :: atom(), value :: term()) :: t()

Sets a new private key and value in the request metadata. This storage is meant to be used by libraries and frameworks to inject information about the request that needs to be retrieved later on, for example, from handlers that consume Finch.Telemetry events.