#[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 = "I'm a teapot";
#[response_reason_phrase("OK")]
async fn success_handler(ctx: Context) {
// Response will have reason phrase "OK"
}
#[response_reason_phrase("Not Found")]
async fn not_found_handler(ctx: Context) {
// Response will have reason phrase "Not Found"
}
#[response_reason_phrase(CUSTOM_REASON)]
async fn custom_handler(ctx: Context) {
// Response will have reason phrase from global constant
}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.