gluegun
gluegun
Section titled “gluegun”Root facade for the Gluegun HTTP client wrapper.
This module exposes a small common-path facade. Submodules expose grouped APIs for connection, low-level request, response, message, and WebSocket concerns.
Functions
Section titled “Functions”body_text
Section titled “body_text”Decode a response body as UTF-8 text.
pub fn body_text(gluegun/response.Response) -> Result(String, gluegun/error.GluegunError)connection_options
Section titled “connection_options”Construct default connection options.
pub fn connection_options() -> gluegun/connection.ConnectOptionsmethod_to_string
Section titled “method_to_string”Convert a request method to an HTTP method string.
pub fn method_to_string(gluegun/request.Method) -> StringReturn the package name.
pub fn name() -> Stringnormalize_headers
Section titled “normalize_headers”Normalize header names for Gun.
pub fn normalize_headers(List(#(String, String))) -> List(#(String, String))Open a Gun connection.
pub fn open(gluegun/connection.ConnectOptions, host: String, port: Int) -> Result(gluegun/internal.Connection, gluegun/error.GluegunError)request
Section titled “request”Send one request and collect the full response.
pub fn request(gluegun/request.Method, String) -> gluegun/client.Requestresponse
Section titled “response”Construct a collected HTTP response.
pub fn response(status: Int, headers: List(#(String, String)), body: BitArray, trailers: List(#(String, String))) -> gluegun/response.ResponseSend a collected HTTP request command.
pub fn send(gluegun/client.Request, connection: gluegun/internal.Connection) -> Result(gluegun/response.Response, gluegun/error.GluegunError)websocket_close
Section titled “websocket_close”Send a close WebSocket frame using a reusable socket.
pub fn websocket_close(gluegun/websocket.Socket) -> Result(Nil, gluegun/error.GluegunError)websocket_connect
Section titled “websocket_connect”Open a connection, perform a WebSocket upgrade, and return a reusable socket.
pub fn websocket_connect(host: String, port: Int, path: String, options: gluegun/websocket.Options) -> Result(gluegun/websocket.Socket, gluegun/error.GluegunError)websocket_options
Section titled “websocket_options”Construct default high-level WebSocket connection options.
pub fn websocket_options() -> gluegun/websocket.Optionswebsocket_receive_app_frame
Section titled “websocket_receive_app_frame”Receive the next application WebSocket frame, handling ping/pong frames.
pub fn websocket_receive_app_frame(gluegun/websocket.Socket) -> Result(gluegun/message.Frame, gluegun/error.GluegunError)websocket_send_text
Section titled “websocket_send_text”Send a text WebSocket frame using a reusable socket.
pub fn websocket_send_text(gluegun/websocket.Socket, String) -> Result(Nil, gluegun/error.GluegunError)websocket_with_socket
Section titled “websocket_with_socket”Open a WebSocket, run a callback, then close the WebSocket and connection.
pub fn websocket_with_socket(host: String, port: Int, path: String, options: gluegun/websocket.Options, callback: fn(gluegun/websocket.Socket) -> Result(a, gluegun/error.GluegunError)) -> Result(a, gluegun/error.GluegunError)with_connect_timeout
Section titled “with_connect_timeout”Set connect timeout on connection options.
pub fn with_connect_timeout(gluegun/connection.ConnectOptions, timeout: gluegun/connection.Timeout) -> gluegun/connection.ConnectOptionswith_protocols
Section titled “with_protocols”Set protocol preferences on connection options.
pub fn with_protocols(gluegun/connection.ConnectOptions, protocols: List(gluegun/connection.Protocol)) -> gluegun/connection.ConnectOptionswith_retry
Section titled “with_retry”Set Gun retry timeout on connection options.
pub fn with_retry(gluegun/connection.ConnectOptions, retry: gluegun/connection.Timeout) -> gluegun/connection.ConnectOptionswith_transport
Section titled “with_transport”Set the transport on connection options.
pub fn with_transport(gluegun/connection.ConnectOptions, transport: gluegun/connection.Transport) -> gluegun/connection.ConnectOptions