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.
- Rust
- AssemblyScript 🧪
- Swift 🧪
In Rust these methods are available under the resp module:
# Use the "resp" module
use suborbital::resp;
# Invoke the "SetHeader" method
resp::set_header(…)
TypeScript/AssemblyScript support is coming soon.
Swift support is coming soon.
The following namespace methods are available:
Set header​
Sets an HTTP response header:
- Rust
- AssemblyScript 🧪
- Swift 🧪
pub fn set_header(key: &str, val: &str)
Not yet available
Not yet available
Content-Type​
An alias of set_header that allows easily setting the
response Content-Type:
- Rust
- AssemblyScript 🧪
- Swift 🧪
pub fn content_type(ctype: &str)
Not yet available
Not yet available