#[try_send_body]Expand description
Automatically tries to send only the response body after function execution.
This attribute macro ensures that only the response body is automatically tried to be sent to the client after the function completes, handling request headers separately.
ยงUsage
use hyperlane::*;
use hyperlane_macros::*;
#[route("/try_send_body")]
struct TrySendBodyTest;
impl ServerHook for TrySendBodyTest {
async fn new(_ctx: &Context) -> Self {
Self
}
#[epilogue_macros(try_send_body)]
async fn handle(self, ctx: &Context) {}
}
impl TrySendBodyTest {
#[try_send_body]
async fn try_send_body_with_ref_self(&self, ctx: &Context) {}
}
#[try_send_body]
async fn standalone_try_send_body_handler(ctx: &Context) {}The macro takes no parameters and should be applied directly to async functions
that accept a &Context parameter.