Skip to content
Welcome to the Gluegun documentation!

gluegun/client

High-level HTTP helpers for existing Gun connections.

These helpers collect regular HTTP/1.1 and HTTP/2 responses into response.Response. Informational 1xx responses are preserved and can be inspected with response.informational. Protocol messages for server push, upgrades, and WebSockets are rejected with InvalidMessage; use the lower-level gluegun/message API for those flows. Full response bodies are collected in memory; use the lower-level APIs for streaming or very large responses.

A collected HTTP request command.

Send DELETE on an open connection and collect the full response.

pub fn delete(gluegun/internal.Connection, String, List(#(String, String)), gluegun/connection.Timeout) -> Result(gluegun/response.Response, gluegun/error.GluegunError)

Send GET on an open connection and collect the full response.

pub fn get(gluegun/internal.Connection, String, List(#(String, String)), gluegun/connection.Timeout) -> Result(gluegun/response.Response, gluegun/error.GluegunError)

Send HEAD on an open connection and collect the full response.

pub fn head(gluegun/internal.Connection, String, List(#(String, String)), gluegun/connection.Timeout) -> Result(gluegun/response.Response, gluegun/error.GluegunError)

Construct a collected HTTP request command.

pub fn new(gluegun/request.Method, String) -> gluegun/client.Request

Send OPTIONS on an open connection and collect the full response.

pub fn options(gluegun/internal.Connection, String, List(#(String, String)), gluegun/connection.Timeout) -> Result(gluegun/response.Response, gluegun/error.GluegunError)

Send PATCH on an open connection and collect the full response.

pub fn patch(gluegun/internal.Connection, String, List(#(String, String)), BitArray, gluegun/connection.Timeout) -> Result(gluegun/response.Response, gluegun/error.GluegunError)

Send POST on an open connection and collect the full response.

pub fn post(gluegun/internal.Connection, String, List(#(String, String)), BitArray, gluegun/connection.Timeout) -> Result(gluegun/response.Response, gluegun/error.GluegunError)

Send PUT on an open connection and collect the full response.

pub fn put(gluegun/internal.Connection, String, List(#(String, String)), BitArray, gluegun/connection.Timeout) -> Result(gluegun/response.Response, gluegun/error.GluegunError)

Send a collected HTTP request command on an open connection.

pub fn send(gluegun/client.Request, connection: gluegun/internal.Connection) -> Result(gluegun/response.Response, gluegun/error.GluegunError)

Send an HTTP request on an open connection and collect its full response.

pub fn send_raw(gluegun/internal.Connection, gluegun/request.Method, String, List(#(String, String)), BitArray, gluegun/request.RequestOptions, gluegun/connection.Timeout) -> Result(gluegun/response.Response, gluegun/error.GluegunError)

Replace the request body.

pub fn with_body(gluegun/client.Request, body: BitArray) -> gluegun/client.Request

Append a single request header.

pub fn with_header(gluegun/client.Request, name: String, value: String) -> gluegun/client.Request

Append request headers.

pub fn with_headers(gluegun/client.Request, headers: List(#(String, String))) -> gluegun/client.Request

Replace low-level request options.

pub fn with_options(gluegun/client.Request, options: gluegun/request.RequestOptions) -> gluegun/client.Request

Replace the request timeout.

pub fn with_timeout(gluegun/client.Request, timeout: gluegun/connection.Timeout) -> gluegun/client.Request