#[unknown_upgrade_type]Expand description
Restricts function execution to requests with unknown protocol upgrade types only.
This attribute macro ensures the decorated function only executes when the incoming request uses an unrecognized or non-standard protocol upgrade type (not WebSocket, h2c, or TLS).
ยงUsage
use hyperlane::*;
use hyperlane_macros::*;
#[route("/unknown_upgrade_type")]
struct UnknownUpgrade;
impl ServerHook for UnknownUpgrade {
async fn new(_: &mut Stream, _: &mut Context) -> Self {
Self
}
#[prologue_macros(unknown_upgrade_type, response_body("unknown upgrade type"))]
async fn handle(self, stream: &mut Stream, ctx: &mut Context) -> Status { Status::Continue }
}
impl UnknownUpgrade {
#[unknown_upgrade_type]
async fn unknown_upgrade_type_with_ref_self(&self, stream: &mut Stream, ctx: &mut Context) -> Status { Status::Continue }
}
#[unknown_upgrade_type]
async fn standalone_unknown_upgrade_type_handler(stream: &mut Stream, ctx: &mut Context) -> Status { Status::Continue }The macro takes no parameters and should be applied directly to async functions
that accept a &mut Context parameter.