#[head_method]Expand description
Restricts function execution to HTTP HEAD requests only.
This attribute macro ensures the decorated function only executes when the incoming request uses the HEAD HTTP method. Requests with other methods will be filtered out.
ยงUsage
use hyperlane::*;
use hyperlane_macros::*;
#[route("/head_method")]
struct Head;
impl ServerHook for Head {
async fn new(_ctx: &mut Context) -> Self {
Self
}
#[prologue_macros(head_method, response_body("head_method"))]
async fn handle(self, ctx: &mut Context) {}
}
impl Head {
#[head_method]
async fn head_with_ref_self(&self, ctx: &mut Context) {}
}
#[head_method]
async fn standalone_head_handler(ctx: &mut Context) {}The macro takes no parameters and should be applied directly to async functions
that accept a &mut Context parameter.