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