Attribute Macro request_body

Source
#[request_body]
Expand description

Extracts the raw request body into a specified variable.

This attribute macro extracts the raw request body content into a variable with the fixed type RequestBody. The body content is not parsed or deserialized.

ยงUsage

use hyperlane::*;
use hyperlane_macros::*;

#[request_body(raw_body)]
async fn handle_raw_body(ctx: Context) {
    // Use the raw request body
    let body_content = raw_body;
}

The macro accepts only a variable name. The variable will be available in the function scope as a RequestBody type.