Finch.Request (Finch v0.20.0)

View Source

A request struct.

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.

Types

body()

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

Optional request body.

headers()

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

Request headers.

method()

@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().

private_metadata()

@type private_metadata() :: %{optional(atom()) => term()}

t()

@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
}

url()

@type url() :: String.t() | URI.t()

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

Functions

put_private(request, key, value)

@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.