HTTP.FetchOptions (http_fetch v0.9.1)
Options processing for HTTP.fetch/2 requests.
HTTP.fetch/2 accepts a flat init keyword list or map, mirroring the browser
fetch(input, init) shape. Supported fetch-style options are:
method- HTTP method, defaulting toGETheaders- request headers as a list, map, orHTTP.Headersbody- request bodysignal-HTTP.AbortControllerPIDredirect-:follow,:manual, or:error; defaults to:follow
The socket transport also accepts Elixir-specific extensions:
content_type- convenience Content-Type value for request bodiestimeout- request timeout in millisecondsconnect_timeout- connection timeout in millisecondsssl- TLS options passed to:sslsocket_opts- socket options passed to the underlying transportunix_socket- Unix Domain Socket path
Summary
Functions
Extracts body from options.
Extracts content type from options.
Extracts headers from options.
Extracts the HTTP method from options.
Creates a new FetchOptions struct from a flat map, keyword list, or existing FetchOptions struct.
Converts fetch init options to the internal socket transport option list.
Types
@type redirect() :: :follow | :manual | :error
@type t() :: %HTTP.FetchOptions{ body: any(), connect_timeout: integer() | nil, content_type: String.t() | nil, headers: HTTP.Headers.t(), method: atom(), redirect: redirect(), signal: any() | nil, socket_opts: list() | nil, ssl: list() | nil, timeout: integer() | nil, unix_socket: String.t() | nil }
Functions
Extracts body from options.
Extracts content type from options.
@spec get_headers(t()) :: HTTP.Headers.t()
Extracts headers from options.
Extracts the HTTP method from options.
Creates a new FetchOptions struct from a flat map, keyword list, or existing FetchOptions struct.
Converts fetch init options to the internal socket transport option list.