View Source Antikythera.Httpc (antikythera v0.5.0)
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 dataiolist- 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 is8000.:recv_timeout- Timeout used when receiving a response. Default is5000.: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.Httpcautomatically 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 thesslerlang module.:skip_ssl_verification- Whether to verify server's SSL certificate or not. Defaults tofalse. Specifyskip_ssl_verification: truewhen accessing insecure server with HTTPS.:max_body- Maximum content-length of the response body (compressed size if it's compressed). Defaults to10485760(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 tofalse.:max_redirect- An integer denoting the maximum number of redirects to follow iffollow_redirect: trueis given.:skip_body_decompression- By default gzip-compressed body is automatically decompressed (i.e. defaults tofalse). Passskip_body_decompression: trueif compressed body is what you need.
Summary
Functions
@spec default_max_body() :: pos_integer()
@spec delete( Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Croma.Result.t(Antikythera.Httpc.Response.t())
@spec delete!( Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Antikythera.Httpc.Response.t()
@spec get( Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Croma.Result.t(Antikythera.Httpc.Response.t())
@spec get!( Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Antikythera.Httpc.Response.t()
@spec head( Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Croma.Result.t(Antikythera.Httpc.Response.t())
@spec head!( Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Antikythera.Httpc.Response.t()
@spec maximum_max_body() :: pos_integer()
@spec options( Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Croma.Result.t(Antikythera.Httpc.Response.t())
@spec options!( Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Antikythera.Httpc.Response.t()
@spec patch( Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Croma.Result.t(Antikythera.Httpc.Response.t())
@spec patch!( Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Antikythera.Httpc.Response.t()
@spec post( Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Croma.Result.t(Antikythera.Httpc.Response.t())
@spec post!( Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Antikythera.Httpc.Response.t()
@spec put( Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Croma.Result.t(Antikythera.Httpc.Response.t())
@spec put!( Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Antikythera.Httpc.Response.t()
@spec request( Antikythera.Http.Method.t(), Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Croma.Result.t(Antikythera.Httpc.Response.t())
@spec request!( Antikythera.Http.Method.t(), Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Antikythera.Httpc.Response.t()