View Source Tulle.HTTP (tulle v0.7.3)

Make HTTP requests with a Tulle.HTTP1.Client or Tulle.HTTP2.Client.

Summary

Types

Method-path-header triple.

A Collectable that writes to an HTTP request stream.

Functions

Sends EOF for the collectable returned by request_collectable!/2.

Get the custom data that was put with set_info/2

Sends a request. Returns a triple of the status, the headers, and the response body stream.

Start a streaming request.

Put arbitrary custom data that can be accessed with get_info/1

Types

A Tulle.HTTP1.Client or Tulle.HTTP2.Client or process.

Link to this type

req_params(method_alt)

View Source
@type req_params(method_alt) ::
  {method :: String.t() | method_alt, path :: String.t(), Mint.Types.headers()}

Method-path-header triple.

req_params(atom) would indicate method can be either a string or atom.

@opaque request()

A Collectable that writes to an HTTP request stream.

Created with request_collectable!/2. When done sending, close_request!/1 must be called to signal the EOF.

Functions

@spec close_request!(request()) ::
  {pos_integer(), Mint.Types.headers(), iodata_stream :: Enum.t()}

Sends EOF for the collectable returned by request_collectable!/2.

Returns a triple of the status, the headers, and the response body stream.

@spec get_info(request()) :: any()

Get the custom data that was put with set_info/2

Link to this function

request!(client, meth_path_headers, body, timeout \\ 10000)

View Source
@spec request!(client(), req_params(atom()), iodata() | nil, timeout()) ::
  {pos_integer(), Mint.Types.headers(), iodata_stream :: Enum.t()}

Sends a request. Returns a triple of the status, the headers, and the response body stream.

Link to this function

request_collectable!(client, arg)

View Source
@spec request_collectable!(client(), req_params(atom())) :: request()

Start a streaming request.

The returned request/0 object can be Enum.into/2'ed. Call close_request!/1 to signal the EOF.

@spec set_info(request(), any()) :: request()

Put arbitrary custom data that can be accessed with get_info/1