Skip to main content

Modifying responses

When a Runnable is used to handle an HTTP request, Atmo will bind that request to the Runnable. The resp namespace of the Runnable API can then be used to modify the response that Atmo will send to the caller.

NOTE

Currently the Response API has limited language support, additional implementations are tracked in this issue.

In Rust these methods are available under the resp module:

# Use the "resp" module
use suborbital::resp;

# Invoke the "SetHeader" method
resp::set_header(…)

The following namespace methods are available:

Set header

Sets an HTTP response header:

Content-Type

An alias of set_header that allows easily setting the response Content-Type: