antikythera v0.3.0 Antikythera.Httpc View Source
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 (see #86169)
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 120MB. 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.
Link to this section Summary
Link to this section Functions
Link to this function
delete(url, headers \\ %{}, options \\ [])
View Sourcedelete(Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t()) :: Croma.Result.t(Antikythera.Httpc.Response.t())
Link to this function
delete!(url, headers \\ %{}, options \\ [])
View Sourcedelete!(Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t()) :: Antikythera.Httpc.Response.t()
Link to this function
get!(url, headers \\ %{}, options \\ [])
View Sourceget!(Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t()) :: Antikythera.Httpc.Response.t()
Link to this function
head(url, headers \\ %{}, options \\ [])
View Sourcehead(Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t()) :: Croma.Result.t(Antikythera.Httpc.Response.t())
Link to this function
head!(url, headers \\ %{}, options \\ [])
View Sourcehead!(Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t()) :: Antikythera.Httpc.Response.t()
Link to this function
options(url, headers \\ %{}, options \\ [])
View Sourceoptions(Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t()) :: Croma.Result.t(Antikythera.Httpc.Response.t())
Link to this function
options!(url, headers \\ %{}, options \\ [])
View Sourceoptions!(Antikythera.Url.t(), Antikythera.Http.Headers.t(), Keyword.t()) :: Antikythera.Httpc.Response.t()
Link to this function
patch(url, body, headers, options \\ [])
View Sourcepatch( Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Croma.Result.t(Antikythera.Httpc.Response.t())
Link to this function
patch!(url, body, headers, options \\ [])
View Sourcepatch!( Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Antikythera.Httpc.Response.t()
Link to this function
post!(url, body, headers, options \\ [])
View Sourcepost!( Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Antikythera.Httpc.Response.t()
Link to this function
put!(url, body, headers, options \\ [])
View Sourceput!( Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Antikythera.Httpc.Response.t()
Link to this function
request(method, url, body, headers \\ %{}, options \\ [])
View Sourcerequest( Antikythera.Http.Method.t(), Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Croma.Result.t(Antikythera.Httpc.Response.t())
Link to this function
request!(method, url, body, headers \\ %{}, options \\ [])
View Sourcerequest!( Antikythera.Http.Method.t(), Antikythera.Url.t(), Antikythera.Httpc.ReqBody.t(), Antikythera.Http.Headers.t(), Keyword.t() ) :: Antikythera.Httpc.Response.t()