httpotion v3.0.3 HTTPotion View Source

The HTTP client for Elixir.

This module contains a basic general-purpose HTTP client. Everything in this module is created with use HTTPotion.Base. You can create your own customized client modules (see the README).

Link to this section Summary

Functions

A shortcut for request(:delete, url, options)

A shortcut for request!(:delete, url, options)

A shortcut for request(:get, url, options)

A shortcut for request!(:get, url, options)

A shortcut for request(:head, url, options)

A shortcut for request!(:head, url, options)

A shortcut for request(:options, url, options)

A shortcut for request!(:options, url, options)

A shortcut for request(:patch, url, options)

A shortcut for request!(:patch, url, options)

A shortcut for request(:post, url, options)

A shortcut for request!(:post, url, options)

A shortcut for request(:put, url, options)

A shortcut for request!(:put, url, options)

Sends an HTTP request

Deprecated form of request; body and headers are now options, see request/3

Like request, but raises HTTPotion.HTTPError if failed

Deprecated form of request with the direct option; body and headers are now options, see request/3

Starts a linked worker process for use with the direct option

Starts a worker process for use with the direct option

Ensures that HTTPotion and its dependencies are started

Link to this section Functions

Link to this function delete(url, options \\ []) View Source

A shortcut for request(:delete, url, options).

Link to this function delete!(url, options \\ []) View Source

A shortcut for request!(:delete, url, options).

A shortcut for request(:get, url, options).

Link to this function get!(url, options \\ []) View Source

A shortcut for request!(:get, url, options).

Link to this function handle_response(response) View Source
Link to this function head(url, options \\ []) View Source

A shortcut for request(:head, url, options).

Link to this function head!(url, options \\ []) View Source

A shortcut for request!(:head, url, options).

Link to this function options(url, options \\ []) View Source

A shortcut for request(:options, url, options).

Link to this function options!(url, options \\ []) View Source

A shortcut for request!(:options, url, options).

Link to this function patch(url, options \\ []) View Source

A shortcut for request(:patch, url, options).

Link to this function patch!(url, options \\ []) View Source

A shortcut for request!(:patch, url, options).

Link to this function post(url, options \\ []) View Source

A shortcut for request(:post, url, options).

Link to this function post!(url, options \\ []) View Source

A shortcut for request!(:post, url, options).

Link to this function process_options(options) View Source
Link to this function process_request_body(body) View Source
Link to this function process_request_headers(headers) View Source
Link to this function process_response_body(body) View Source
Link to this function process_response_chunk(raw) View Source
Link to this function process_response_headers(headers) View Source
Link to this function process_response_location(response) View Source
Link to this function process_status_code(status_code) View Source
Link to this function process_url(url, options) View Source

A shortcut for request(:put, url, options).

Link to this function put!(url, options \\ []) View Source

A shortcut for request!(:put, url, options).

Link to this function request(method, url, options \\ []) View Source
request(atom, String.t, [{atom, any}]) ::
  %HTTPotion.Response{body: term, headers: term, status_code: term} |
  %HTTPotion.AsyncResponse{id: term} |
  %HTTPotion.ErrorResponse{message: term}

Sends an HTTP request.

Args:

  • method - HTTP method, atom (:get, :head, :post, :put, :delete, etc.)
  • url - URL, binary string or char list
  • options - orddict of options

Options:

  • body - request body, binary string or char list
  • headers - HTTP headers, orddict (eg. ["Accept": "application/json"])
  • timeout - timeout in ms, integer
  • basic_auth - basic auth credentials (eg. {"user", "password"})
  • stream_to - if you want to make an async request, the pid of the process
  • direct - if you want to use ibrowse’s direct feature, the pid of the worker spawned by spawn_worker_process/2 or spawn_link_worker_process/2
  • follow_redirects - if true and a response is a redirect, header[:Location] is taken for the next request

Returns HTTPotion.Response or HTTPotion.AsyncResponse if successful. Returns HTTPotion.ErrorResponse if failed.

Link to this function request(method, url, body, headers, options) View Source

Deprecated form of request; body and headers are now options, see request/3.

Link to this function request!(method, url, options \\ []) View Source
request!(atom, String.t, [{atom, any}]) ::
  %HTTPotion.Response{body: term, headers: term, status_code: term} |
  %HTTPotion.AsyncResponse{id: term}

Like request, but raises HTTPotion.HTTPError if failed.

Link to this function request_direct(conn_pid, method, url, body \\ "", headers \\ [], options \\ []) View Source

Deprecated form of request with the direct option; body and headers are now options, see request/3.

Link to this function spawn_worker_process(url, options \\ []) View Source

Starts a worker process for use with the direct option.

Ensures that HTTPotion and its dependencies are started.

Link to this function stop_worker_process(pid) View Source

Stops a worker process started with spawn_worker_process/2 or spawn_link_worker_process/2.

Link to this function transformer(target, method, url, options) View Source