fluminus v1.1.1 Fluminus.HTTPClient View Source
A HTTP client backed by HTTPoison that manages cookies.
Struct fields:
:cookies
- cookies stored by this HTTP client.
Link to this section Summary
Types
All the header keys converted to lowercase, and in case there are some headers with
the same key, the value will contain the value of the last header with that key as returned by HTTPoison
Functions
Downloads from the url
to the destination
Performs a GET request
Performs a POST request
Performs a HTTP request
Link to this section Types
flattened_headers() View Source
All the header keys converted to lowercase, and in case there are some headers with
the same key, the value will contain the value of the last header with that key as returned by HTTPoison
.
headers() View Source
methods()
View Source
methods() :: :get | :post
methods() :: :get | :post
Link to this section Functions
download(client, url, destination, overwrite \\ false, headers \\ [])
View Source
download(Fluminus.HTTPClient.t(), String.t(), Path.t(), bool(), headers()) ::
:ok | {:error, :exists | any()}
download(Fluminus.HTTPClient.t(), String.t(), Path.t(), bool(), headers()) :: :ok | {:error, :exists | any()}
Downloads from the url
to the destination
.
If overwrite
is false
, this function will return {:error, :exists}
if destination alread exists.
get(client, url, headers \\ [])
View Source
get(Fluminus.HTTPClient.t(), String.t(), headers()) ::
{:ok, Fluminus.HTTPClient.t(), flattened_headers(), HTTPoison.Response.t()}
| {:error,
%HTTPoison.Error{__exception__: term(), id: term(), reason: term()}}
get(Fluminus.HTTPClient.t(), String.t(), headers()) :: {:ok, Fluminus.HTTPClient.t(), flattened_headers(), HTTPoison.Response.t()} | {:error, %HTTPoison.Error{__exception__: term(), id: term(), reason: term()}}
Performs a GET request.
This is a convenience method that will call request/5
post(client, url, body, headers \\ [{"Content-Type", "application/x-www-form-urlencoded"}])
View Source
post(Fluminus.HTTPClient.t(), String.t(), String.t(), headers()) ::
{:ok, Fluminus.HTTPClient.t(), flattened_headers(), HTTPoison.Response.t()}
| {:error,
%HTTPoison.Error{__exception__: term(), id: term(), reason: term()}}
post(Fluminus.HTTPClient.t(), String.t(), String.t(), headers()) :: {:ok, Fluminus.HTTPClient.t(), flattened_headers(), HTTPoison.Response.t()} | {:error, %HTTPoison.Error{__exception__: term(), id: term(), reason: term()}}
Performs a POST request.
This is a convenience method that will call request/5
request(client, method, url, body, headers)
View Source
request(Fluminus.HTTPClient.t(), methods(), String.t(), String.t(), headers()) ::
{:ok, Fluminus.HTTPClient.t(), flattened_headers(), HTTPoison.Response.t()}
| {:error,
%HTTPoison.Error{__exception__: term(), id: term(), reason: term()}}
request(Fluminus.HTTPClient.t(), methods(), String.t(), String.t(), headers()) :: {:ok, Fluminus.HTTPClient.t(), flattened_headers(), HTTPoison.Response.t()} | {:error, %HTTPoison.Error{__exception__: term(), id: term(), reason: term()}}
Performs a HTTP request.