HTTPX v0.0.4 HTTPX View Source

Simple HTTP(s) client with integrated auth methods.

Link to this section Summary

Functions

Performs a get request

Performs a get request

Performs a post request, passing the body in the options

Performs a post request, passing the body in the options

Link to this section Types

Link to this type post_body() View Source
post_body ::
  String.t |
  {:urlencoded, map | keyword} |
  {:json, map | keyword | String.t}

Link to this section Functions

Link to this function get(url, options \\ []) View Source
get(String.t, keyword) ::
  {:ok, HTTPX.Response.t} |
  {:error, term}

Performs a get request.

For options see: &request/3.

Link to this function get!(url, options \\ []) View Source
get!(String.t, keyword) :: HTTPX.Response.t

Performs a get request.

For options see: &get/2.

Link to this function post(url, body, options \\ []) View Source
post(String.t, post_body, keyword) ::
  {:ok, HTTPX.Response.t} |
  {:error, term}

Performs a post request, passing the body in the options.

For options see: &request/3.

Link to this function post!(url, body, options \\ []) View Source
post!(String.t, post_body, keyword) :: HTTPX.Response.t

Performs a post request, passing the body in the options.

For options see: &post/3.

Link to this function request(method, url, options \\ []) View Source
request(term, String.t, keyword) ::
  {:ok, HTTPX.Response.t} |
  {:error, term}

Performs a request.

The given method is used and the url is called.

The following options can be set:

  • :body, the body to send with the request.
  • :params, a map containing query params.
  • :headers, list of header tuples.
  • :settings, options to pass along to :hackney.
  • :fail, will error out any request with a non 2xx response code, when set to true.
  • :auth, set authorization options.
  • :format, set to parse. (Like :json)