Tesla.Client (tesla v1.4.0) View Source
Link to this section Summary
Functions
Returns the client's adapter in the same form it was provided. This can be used to copy an adapter from one client to another.
Returns the client's middleware in the same form it was provided. This can be used to copy middleware from one client to another.
Link to this section Types
Specs
adapter() :: module() | {module(), any()} | (Tesla.Env.t() -> Tesla.Env.result())
Specs
Specs
t() :: %Tesla.Client{ adapter: adapter() | nil, fun: term(), post: Tesla.Env.stack(), pre: Tesla.Env.stack() }
Link to this section Functions
Specs
Returns the client's adapter in the same form it was provided. This can be used to copy an adapter from one client to another.
Example
iex> client = Tesla.client([], {Tesla.Adapter.Hackney, [recv_timeout: 30_000]})
iex> Tesla.Client.adapter(client)
{Tesla.Adapter.Hackney, [recv_timeout: 30_000]}
Specs
middleware(t()) :: [middleware()]
Returns the client's middleware in the same form it was provided. This can be used to copy middleware from one client to another.
Example
iex> middleware = [Tesla.Middleware.JSON, {Tesla.Middleware.BaseUrl, "https://api.github.com"}]
iex> client = Tesla.client(middleware)
iex> Tesla.Client.middleware(client)
[Tesla.Middleware.JSON, {Tesla.Middleware.BaseUrl, "https://api.github.com"}]