#[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: &mut Context) -> Self {
Self
}
#[epilogue_macros(try_send_body)]
async fn handle(self, ctx: &mut Context) {}
}
impl TrySendBodyTest {
#[try_send_body]
async fn try_send_body_with_ref_self(&self, ctx: &mut Context) {}
}
#[try_send_body]
async fn standalone_try_send_body_handler(ctx: &mut Context) {}The macro takes no parameters and should be applied directly to async functions
that accept a &mut Context parameter.