#[head]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")]
struct Head;
impl ServerHook for Head {
async fn new(_ctx: &Context) -> Self {
Self
}
#[prologue_macros(head, response_body("head"))]
async fn handle(self, ctx: &Context) {}
}
impl Head {
#[head]
async fn head_with_ref_self(&self, ctx: &Context) {}
}
#[head]
async fn standalone_head_handler(ctx: &Context) {}The macro takes no parameters and should be applied directly to async functions
that accept a &Context parameter.