gluegun
gluegun
Section titled “gluegun”Minimal common-path facade for the Gluegun HTTP client wrapper.
For full functionality import the submodules (gluegun/connection,
gluegun/request, gluegun/client, gluegun/websocket,
gluegun/message, gluegun/response, gluegun/error).
Functions
Section titled “Functions”await_up
Section titled “await_up”Wait until a Gun connection is up.
pub fn await_up( internal.Connection, connection.Timeout) -> Result(connection.Protocol, error.GluegunError)body_text
Section titled “body_text”Decode a response body as UTF-8 text.
pub fn body_text(response.Response) -> Result(String, error.GluegunError)connection_options
Section titled “connection_options”Construct default connection options.
pub fn connection_options() -> connection.ConnectOptionsmethod_to_string
Section titled “method_to_string”Convert a request method to an HTTP method string.
pub fn method_to_string(request.Method) -> StringReturn the package name.
pub fn name() -> Stringnew_request
Section titled “new_request”Construct a Request builder.
pub fn new_request( request.Method, String) -> client.Requestnormalize_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( connection.ConnectOptions, host: String, port: Int) -> Result(internal.Connection, error.GluegunError)response
Section titled “response”Construct a collected HTTP response.
pub fn response( status: Int, headers: List(#(String, String)), body: BitArray, trailers: List(#(String, String))) -> response.ResponseSend a Request on an open connection.
pub fn send( client.Request, connection: internal.Connection) -> Result(response.Response, error.GluegunError)tls_options
Section titled “tls_options”Construct default TLS options.
pub fn tls_options() -> tls.TlsOptionswebsocket_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: websocket.Options) -> Result(websocket.Socket, error.GluegunError)websocket_options
Section titled “websocket_options”Construct default high-level WebSocket connection options.
pub fn websocket_options() -> 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(websocket.Socket) -> Result(message.Frame, error.GluegunError)websocket_send_close_frame
Section titled “websocket_send_close_frame”Send a close WebSocket frame using a reusable socket.
pub fn websocket_send_close_frame(websocket.Socket) -> Result(Nil, error.GluegunError)websocket_send_text
Section titled “websocket_send_text”Send a text WebSocket frame using a reusable socket.
pub fn websocket_send_text( websocket.Socket, String) -> Result(Nil, 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: websocket.Options, callback: fn(websocket.Socket) -> Result(a, error.GluegunError)) -> Result(a, error.GluegunError)with_connect_timeout
Section titled “with_connect_timeout”Set connect timeout on connection options.
pub fn with_connect_timeout( connection.ConnectOptions, timeout: connection.Timeout) -> connection.ConnectOptionswith_protocols
Section titled “with_protocols”Set protocol preferences on connection options.
pub fn with_protocols( connection.ConnectOptions, protocols: List(connection.Protocol)) -> connection.ConnectOptionswith_retry
Section titled “with_retry”Set Gun retry timeout on connection options.
pub fn with_retry( connection.ConnectOptions, retry: connection.Timeout) -> connection.ConnectOptionswith_tls_opts
Section titled “with_tls_opts”Set TLS options on connection options.
pub fn with_tls_opts( connection.ConnectOptions, tls_opts: tls.TlsOptions) -> connection.ConnectOptionswith_transport
Section titled “with_transport”Set the transport on connection options.
pub fn with_transport( connection.ConnectOptions, transport: connection.Transport) -> connection.ConnectOptions