gluegun/request
gluegun/request
Section titled “gluegun/request”Low-level HTTP request and stream operations.
Use this module when you need Gun stream references, chunked request
bodies, flow-control updates, cancellation, or direct access to asynchronous
Gun messages. For simple full-body responses, prefer gluegun/client.
Method
Section titled “Method”HTTP request method constructors.
Use canonical constructors such as Get, Post, and Put, or Custom
for extension methods.
Get()Head()Post()Put()Patch()Delete()Options()Trace()Connect()Custom(String)
RequestOptions
Section titled “RequestOptions”Request options passed through the low-level request API.
Type aliases
Section titled “Type aliases”Header
Section titled “Header”HTTP header represented as #(name, value).
pub type Header = UnknownFunctions
Section titled “Functions”cancel
Section titled “cancel”Cancel a request stream.
pub fn cancel(gluegun/internal.Connection, gluegun/internal.Stream) -> Result(Nil, gluegun/error.GluegunError)Stream request body data for a request.
pub fn data(gluegun/internal.Connection, gluegun/internal.Stream, gluegun/fin.Fin, BitArray) -> Result(Nil, gluegun/error.GluegunError)Flush Gun messages for a connection.
pub fn flush(gluegun/internal.Connection) -> Result(Nil, gluegun/error.GluegunError)headers
Section titled “headers”Start a low-level HTTP request whose body will be streamed later.
The caller must send request body chunks with data(..., fin.NoFin, ...) and
complete the request with data(..., fin.Fin, ...). Gun response messages go to
the calling process by default unless Gun request options redirect replies.
pub fn headers(gluegun/internal.Connection, gluegun/request.Method, String, List(#(String, String)), gluegun/request.RequestOptions) -> Result(gluegun/internal.Stream, gluegun/error.GluegunError)method_to_string
Section titled “method_to_string”Convert a method constructor to its HTTP method string.
pub fn method_to_string(gluegun/request.Method) -> Stringnormalize_headers
Section titled “normalize_headers”Lowercase header names for the Erlang Gun FFI boundary without changing values.
pub fn normalize_headers(List(#(String, String))) -> List(#(String, String))options
Section titled “options”Construct default request options.
pub fn options() -> gluegun/request.RequestOptionsrequest
Section titled “request”Send a low-level HTTP request on an open Gun connection.
This returns a stream reference. Use gluegun/client helpers to collect a
regular HTTP response into a Response.
pub fn request(gluegun/internal.Connection, gluegun/request.Method, String, List(#(String, String)), BitArray, gluegun/request.RequestOptions) -> Result(gluegun/internal.Stream, gluegun/error.GluegunError)set_headers
Section titled “set_headers”Replace option-level headers.
pub fn set_headers(gluegun/request.RequestOptions, headers: List(#(String, String))) -> gluegun/request.RequestOptionsupdate_flow
Section titled “update_flow”Update HTTP/1.1 or HTTP/2 stream flow control by the given increment.
The increment must be positive. Gun rejects non-positive flow-control
increments, so this function validates the value before crossing the FFI
boundary and returns InvalidOptions for zero or negative increments.
pub fn update_flow(gluegun/internal.Connection, gluegun/internal.Stream, Int) -> Result(Nil, gluegun/error.GluegunError)with_headers
Section titled “with_headers”Add option-level headers that are appended to per-call headers.
pub fn with_headers(gluegun/request.RequestOptions, headers: List(#(String, String))) -> gluegun/request.RequestOptions