View Source Tulle.HTTP (tulle v0.7.1)
Make HTTP requests with a Tulle.HTTP1.Client
or Tulle.HTTP2.Client
.
Summary
Types
A Tulle.HTTP1.Client
or Tulle.HTTP2.Client
or process.
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
@type client() :: Tulle.HTTP1.Client.http1_client() | Tulle.HTTP2.Client.http2_client()
A Tulle.HTTP1.Client
or Tulle.HTTP2.Client
or process.
@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.
Get the custom data that was put with set_info/2
@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.
@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.
Put arbitrary custom data that can be accessed with get_info/1