HTTP.FetchOptions (http_fetch v0.5.0)
Processes fetch options for HTTP requests, supporting flat map, keyword list, and HTTP.FetchOptions struct formats. Handles conversion to :httpc.request arguments.
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 various input formats. Supports flat map, keyword list, or existing FetchOptions struct.
Converts FetchOptions to HTTP options for :httpc.request 3rd argument. Returns keyword list of HttpOptions.
Converts FetchOptions to options for :httpc.request 4th argument. Returns keyword list of Options.
Types
@type t() :: %HTTP.FetchOptions{ autoredirect: boolean() | nil, body: any(), body_format: atom() | nil, connect_timeout: integer() | nil, content_type: String.t() | nil, full_result: boolean() | nil, headers: HTTP.Headers.t(), headers_as_is: boolean() | nil, ipv6_host_with_brackets: boolean() | nil, method: atom(), options: keyword(), opts: keyword(), proxy_auth: tuple() | nil, receiver: pid() | function() | tuple() | nil, relaxed: boolean() | nil, signal: any() | nil, socket_opts: list() | nil, ssl: list() | nil, stream: atom() | tuple() | nil, timeout: integer() | nil, version: 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 various input formats. Supports flat map, keyword list, or existing FetchOptions struct.
Converts FetchOptions to HTTP options for :httpc.request 3rd argument. Returns keyword list of HttpOptions.
Converts FetchOptions to options for :httpc.request 4th argument. Returns keyword list of Options.