response_version

Attribute Macro response_version 

Source
#[response_version]
Expand description

Sets the HTTP response version.

This attribute macro configures the HTTP response version that will be sent with the response. The version can be provided as a variable or code block.

ยงUsage

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

#[request_middleware]
struct RequestMiddleware;

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

    #[epilogue_macros(
        response_status_code(200),
        response_version(HttpVersion::HTTP1_1),
        response_header(SERVER => HYPERLANE)
    )]
    async fn handle(self, ctx: &Context) {}
}

The macro accepts a variable or code block for the response version and should be applied to async functions that accept a &Context parameter.