send_body_with_data

Attribute Macro send_body_with_data 

Source
#[send_body_with_data]
Expand description

Sends only the response body with data after function execution.

This attribute macro ensures that only the response body is automatically sent to the client after the function completes, handling request headers separately, with the specified data.

ยงUsage

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

#[route("/send_body_with_data")]
struct SendBodyWithData;

impl ServerHook for SendBodyWithData {
    async fn new(_ctx: &Context) -> Self {
        Self
    }

    #[epilogue_macros(send_body_with_data("Response body content"))]
    async fn handle(self, ctx: &Context) {}
}

The macro accepts data to send and should be applied to async functions that accept a &Context parameter.