#[request_query]Expand description
Extracts a specific request query parameter into a variable.
This attribute macro retrieves a specific request query parameter by key and makes it available as a variable. Query parameters are extracted from the URL request query string.
ยงUsage
use hyperlane::*;
use hyperlane_macros::*;
#[route("/request_query")]
struct RequestQuery;
impl ServerHook for RequestQuery {
async fn new(_ctx: &Context) -> Self {
Self
}
#[prologue_macros(
request_query("test" => request_query_option),
response_body(&format!("request query: {request_query_option:?}")),
send
)]
async fn handle(self, ctx: &Context) {}
}The macro accepts a key-to-variable mapping in the format "key" => variable_name.
The variable will be available as an Option<String> in the function scope.