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