Skip to content
Welcome to the Gluegun documentation!

gluegun/response

HTTP response values collected by gluegun/client.

A response contains the final status, headers, full body, trailers, and any informational 1xx responses seen before the final response.

Full HTTP response collected from a Gun stream.

Informational 1xx response represented by status and headers.

pub type Informational = Unknown

Return the full collected response body.

pub fn body(gluegun/response.Response) -> BitArray

Decode a response body as UTF-8 text.

pub fn body_text(gluegun/response.Response) -> Result(String, gluegun/error.GluegunError)

Return final response headers.

pub fn headers(gluegun/response.Response) -> List(#(String, String))

Return informational 1xx responses received before the final response.

pub fn informational(gluegun/response.Response) -> List(#(Int, List(#(String, String))))

Construct a response without informational responses.

pub fn new(status: Int, headers: List(#(String, String)), body: BitArray, trailers: List(#(String, String))) -> gluegun/response.Response

Return the final response status.

pub fn status(gluegun/response.Response) -> Int

Return response trailers.

pub fn trailers(gluegun/response.Response) -> List(#(String, String))

Return a response with a replaced body.

pub fn with_body(gluegun/response.Response, body: BitArray) -> gluegun/response.Response

Return a response with replaced informational responses.

pub fn with_informational(gluegun/response.Response, informational: List(#(Int, List(#(String, String))))) -> gluegun/response.Response

Return a response with replaced trailers.

pub fn with_trailers(gluegun/response.Response, trailers: List(#(String, String))) -> gluegun/response.Response