View Source Flowy.Support.Http (Flowy v0.1.4)

The Http module provides a simple API for interacting with the configured http client.

Options

  • :opts (non-empty keyword/0) - The default value is [receive_timeout: 15000].

    • :receive_timeout (integer/0) - The maximum time to wait for a response before returning an error The default value is 15000.

    • :pool_timeout (integer/0) - This timeout is applied when we check out a connection from the pool. The default value is 5000.

  • :client (atom/0) - the HTTP client module to use. The default value is Flowy.Support.Http.FinchClient.

Summary

Functions

Builds a new HTTP client struct.

Makes a DELETE request.

Makes a DELETE request, using the provided client.

Makes a GET request.

Makes a GET request, using the provided client.

Makes a PATCH request.

Makes a PATCH request, using the provided client.

Makes a POST request.

Makes a POST request, using the provided client.

Makes a PUT request.

Makes a PUT request, using the provided client.

Types

@type response() :: Flowy.Support.Http.Response.t()
@type t() :: %Flowy.Support.Http{client: module(), opts: keyword()}

Functions

@spec build(opts :: keyword()) :: t()

Builds a new HTTP client struct.

Examples

iex> Flowy.Support.Http.build() %Flowy.Support.Http{

client: Flowy.Support.Http.FinchClient,
opts: [pool_timeout: 5000, receive_timeout: 15000]

}

iex> Flowy.Support.Http.build(opts: [receive_timeout: 10_000]) %Flowy.Support.Http{

client: Flowy.Support.Http.FinchClient,
opts: [pool_timeout: 5000, receive_timeout: 10000]

}

@spec delete(url :: String.t(), headers :: keyword()) :: response()

Makes a DELETE request.

Link to this function

delete(module, url, headers)

View Source
@spec delete(client :: t(), url :: String.t(), headers :: keyword()) :: response()

Makes a DELETE request, using the provided client.

Link to this function

do_request(http, method, url, headers)

View Source
Link to this function

do_request(http, method, url, headers, body)

View Source
@spec get(url :: String.t(), headers :: keyword()) :: response()

Makes a GET request.

Link to this function

get(module, url, headers)

View Source
@spec get(t(), url :: String.t(), headers :: keyword()) :: response()

Makes a GET request, using the provided client.

Link to this function

patch(url, body, headers)

View Source
@spec patch(url :: String.t(), body :: map(), headers :: keyword()) :: response()

Makes a PATCH request.

Link to this function

patch(module, url, body, headers)

View Source
@spec patch(client :: t(), url :: String.t(), body :: map(), headers :: keyword()) ::
  response()

Makes a PATCH request, using the provided client.

Link to this function

post(url, body, headers)

View Source
@spec post(url :: String.t(), body :: map(), headers :: keyword()) :: response()

Makes a POST request.

Link to this function

post(module, url, body, headers)

View Source
@spec post(client :: t(), url :: String.t(), body :: map(), headers :: keyword()) ::
  response()

Makes a POST request, using the provided client.

@spec put(url :: String.t(), body :: map(), headers :: keyword()) :: response()

Makes a PUT request.

Link to this function

put(module, url, body, headers)

View Source
@spec put(client :: t(), url :: String.t(), body :: map(), headers :: keyword()) ::
  response()

Makes a PUT request, using the provided client.