Skip to main content

options

Attribute Macro options 

Source
#[options]
Expand description

Mark a function as an OPTIONS handler.

OPTIONS requests return allowed methods and CORS headers for a resource.

§Example

#[options("/items")]
async fn options_items() -> Response {
    Response::builder()
        .header("Allow", "GET, POST, OPTIONS")
        .body(())
}