send_body_once

Attribute Macro send_body_once 

Source
#[send_body_once]
Expand description

Sends only the response body exactly once after function execution.

This attribute macro ensures that the response body is sent exactly once to the client, preventing multiple body transmissions for single-use scenarios.

ยงUsage

use hyperlane::*;
use hyperlane_macros::*;

#[send_body_once]
async fn send_body_once_handler(ctx: Context) {
    let _ = ctx.set_response_body("One-time body content").await;
    // Response body is sent exactly once after function returns
}

The macro takes no parameters and should be applied directly to async functions that accept a Context parameter.