messua/both

Operations that can be applied symmetrically to either variant of an MResponse.

Functions

pub fn append_body_text(
  resp: Result(Response(ResponseData), Err),
  body: String,
) -> Result(Response(ResponseData), Err)

Append the given string to the response body.

If the response doesn’t already have a body, it will be given one; if the response has a “file” body, this will replace it.

pub fn with_header(
  resp: Result(Response(ResponseData), Err),
  name: String,
  value: String,
) -> Result(Response(ResponseData), Err)

Add the given Name: Value header to the response.

pub fn with_text_body(
  resp: Result(Response(ResponseData), Err),
  body: String,
) -> Result(Response(ResponseData), Err)

Set the response body to the given text string, along with the appropriate Content-Type.

If the response already has a body, this will replace it.

Search Document