#[response_reason_phrase]Expand description
Sets the HTTP reason phrase for the response.
This attribute macro configures the HTTP reason phrase that accompanies the status code. The reason phrase can be provided as a string literal or a global constant.
ยงUsage
use hyperlane::*;
use hyperlane_macros::*;
const CUSTOM_REASON: &str = "Accepted";
#[route("/response_reason")]
struct ResponseReason;
impl ServerHook for ResponseReason {
async fn new(_ctx: &Context) -> Self {
Self
}
#[response_reason_phrase(CUSTOM_REASON)]
async fn handle(self, ctx: &Context) {}
}
impl ResponseReason {
#[response_reason_phrase(CUSTOM_REASON)]
async fn response_reason_phrase_with_ref_self(&self, ctx: &Context) {}
}
#[response_reason_phrase("OK")]
async fn standalone_response_reason_phrase_handler(ctx: &Context) {}The macro accepts a string literal or global constant for the reason phrase and should be
applied to async functions that accept a &Context parameter.