#[status_code]
Expand description
Sets the HTTP status code for the response.
This attribute macro configures the HTTP status code that will be sent with the response. The status code should be provided as a numeric value.
ยงUsage
use hyperlane_macros::*;
use hyperlane::*;
#[status_code(200)]
async fn success_handler(ctx: Context) {
// Response will have status code 200
}
#[status_code(404)]
async fn not_found_handler(ctx: Context) {
// Response will have status code 404
}
#[status_code(500)]
async fn error_handler(ctx: Context) {
// Response will have status code 500
}
The macro accepts a numeric HTTP status code (e.g., 200, 404, 500) and should be
applied to async functions that accept a Context
parameter.