Attribute Macro request_cookies

Source
#[request_cookies]
Expand description

Extracts all cookies as a raw string into a variable.

This attribute macro retrieves the entire Cookie header from the request and makes it available as a String variable. If no Cookie header is present, an empty string is used.

ยงUsage

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

#[request_cookies(cookie_value)]
async fn handle_with_cookies(ctx: Context) {
    // Use the cookie value
    if !cookie_value.is_empty() {
        // Process cookie data
    }
}

The macro accepts a variable name that will contain the Cookie header value. The variable will be available as a String in the function scope.