h2c

Attribute Macro h2c 

Source
#[h2c]
Expand description

Restricts function execution to HTTP/2 Cleartext (h2c) requests only.

This attribute macro ensures the decorated function only executes for HTTP/2 cleartext requests that use the h2c upgrade mechanism.

ยงUsage

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

#[route("/h2c")]
struct H2c;

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

    #[prologue_macros(h2c, response_body("h2c"))]
    async fn handle(self, ctx: &Context) {}
}

The macro takes no parameters and should be applied directly to async functions that accept a &Context parameter.