request_path

Attribute Macro request_path 

Source
#[request_path]
Expand description

Extracts the HTTP request path into a variable.

This attribute macro retrieves the request path from the HTTP request and makes it available as a variable. The path represents the URL path portion of the request.

ยงUsage

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

#[request_path(request_path)]
async fn handle_with_path(ctx: Context) {
    // Use the request path
    if request_path.starts_with("/api/") {
        // Handle API requests
    }
}

The macro accepts a variable name that will contain the HTTP request path. The variable will be available as a RequestPath type in the function scope.