View Source Antikythera.Httpc (antikythera v0.5.1)

HTTP client library.

This is a wrapper around hackney, an HTTP client library. Httpc supports the following features:

  • gzip-compression is tranparently handled
  • headers are represented by maps instead of lists
  • header names are always lower case
  • TCP connections are automatically re-established when closed by server due to keepalive timeout

Body format

The body argument in post/4, put/4, patch/4, request/5 takes either:

  • binary - Sends raw data
  • iolist - Sends raw data list (for more details see documentation for built-in types)
  • {:form, [{key, value}]} - Sends key-value data as x-www-form-urlencoded
  • {:json, map} - Converts map into JSON and sends as application/json
  • {:file, path} - Sends given file contents

Options

  • :timeout - Timeout to establish a connection, in milliseconds. Default is 8000.
  • :recv_timeout - Timeout used when receiving a response. Default is 5000.
  • :params - An enumerable of 2-tuples that will be URL-encoded and appended to the URL as query string parameters.
  • :cookie - An enumerable of name-value pairs of cookies. Httpc automatically URL-encodes the given names/values for you.
  • :basic_auth - A pair of {username, password} tuple to be used for HTTP basic authentication.
  • :proxy - A proxy to be used for the request; it can be a regular URL or a {host, port} tuple.
  • :proxy_auth - Proxy authentication {username, password} tuple.
  • :ssl - SSL options supported by the ssl erlang module.
  • :skip_ssl_verification - Whether to verify server's SSL certificate or not. Defaults to false. Specify skip_ssl_verification: true when accessing insecure server with HTTPS.
  • :max_body - Maximum content-length of the response body (compressed size if it's compressed). Defaults to 10485760 (10MB) and must not exceed 150MB. Responses having body larger than the specified size will be rejected with {:error, :response_too_large}.
  • :follow_redirect - A boolean that causes redirects to be followed. Defaults to false.
  • :max_redirect - An integer denoting the maximum number of redirects to follow if follow_redirect: true is given.
  • :skip_body_decompression - By default gzip-compressed body is automatically decompressed (i.e. defaults to false). Pass skip_body_decompression: true if compressed body is what you need.

Summary

Functions

@spec default_max_body() :: pos_integer()
Link to this function

delete(url, headers \\ %{}, options \\ [])

View Source
Link to this function

delete!(url, headers \\ %{}, options \\ [])

View Source
Link to this function

get(url, headers \\ %{}, options \\ [])

View Source
Link to this function

get!(url, headers \\ %{}, options \\ [])

View Source
Link to this function

head(url, headers \\ %{}, options \\ [])

View Source
Link to this function

head!(url, headers \\ %{}, options \\ [])

View Source
@spec maximum_max_body() :: pos_integer()
Link to this function

options(url, headers \\ %{}, options \\ [])

View Source
Link to this function

options!(url, headers \\ %{}, options \\ [])

View Source
Link to this function

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

View Source
Link to this function

patch!(url, body, headers, options \\ [])

View Source
Link to this function

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

View Source
Link to this function

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

View Source
Link to this function

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

View Source
Link to this function

put!(url, body, headers, options \\ [])

View Source
Link to this function

request(method, url, body, headers \\ %{}, options \\ [])

View Source
Link to this function

request!(method, url, body, headers \\ %{}, options \\ [])

View Source