CPub.HTTP (CPub v0.3.0) View Source

Wrapper for Tesla.request/2.

Link to this section Summary

Link to this section Types

Specs

t() :: CPub.HTTP

Link to this section Functions

Link to this function

get(url, headers \\ [], options \\ [])

View Source

Specs

get(CPub.HTTP.Request.url() | nil, CPub.HTTP.Request.headers(), keyword()) ::
  nil | {:ok, Tesla.Env.t()} | {:error, any()}

Performs GET HTTP request.

Link to this function

head(url, headers \\ [], options \\ [])

View Source

Specs

head(CPub.HTTP.Request.url(), CPub.HTTP.Request.headers(), keyword()) ::
  {:ok, Tesla.Env.t()} | {:error, any()}

Performs HEAD HTTP request.

Link to this function

post(url, body, headers \\ [], options \\ [])

View Source

Specs

post(
  CPub.HTTP.Request.url(),
  String.t(),
  CPub.HTTP.Request.headers(),
  keyword()
) ::
  {:ok, Tesla.Env.t()} | {:error, any()}

Performs POST HTTP request.

Link to this function

request(client, request)

View Source

Specs

request(
  Tesla.Client.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}
Link to this function

request(method, url, body, headers, options)

View Source

Specs

Builds and performs HTTP request.