View Source conf_http (conf v0.2.5)

Dead simple HTTP/1.1 client. This is not NIH. The rationale is to avoid dependency bloat.

Link to this section Summary

Link to this section Types

-type error_reason() :: http_return() | {http_error, http_error_reason()} | inet:posix().
-type http_error_reason() ::
    invalid_content_length | invalid_chunk_size | invalid_chunk_trailer |
    {invalid_mime_type, binary()} |
    {invalid_location, binary()} |
    string() |
    binary().
-type http_return() :: {non_neg_integer(), iodata(), [resp_hdr()], binary()}.
-type options() :: #{timeout => non_neg_integer(), hdrs => [req_hdr()]}.
-type req_hdr() :: {atom(), term()} | {iodata(), iodata()}.
-type resp_hdr() :: {atom() | string() | binary(), string() | binary()}.
-type socket() :: gen_tcp:socket().

Link to this section Functions

-spec find_hdr(atom(), [resp_hdr()]) -> {ok, term()} | {error, notfound}.
-spec format_error(error_reason()) -> string().
-spec get(uri_string:uri_map()) -> {ok, [resp_hdr()], binary()} | {error, error_reason()}.
-spec get(uri_string:uri_map(), options()) -> {ok, [resp_hdr()], binary()} | {error, error_reason()}.