http

Attribute Macro http 

Source
#[http]
Expand description

Restricts function execution to standard HTTP requests only.

This attribute macro ensures the decorated function only executes for standard HTTP requests, excluding WebSocket upgrades and other protocol upgrade requests.

ยงUsage

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

#[route("/http")]
struct HttpOnly;

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

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

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