clear_response_headers

Attribute Macro clear_response_headers 

Source
#[clear_response_headers]
Expand description

Clears all response headers.

This attribute macro clears all response headers from the response.

ยงUsage

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

#[route("/unknown_method")]
struct UnknownMethod;

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

    #[prologue_macros(
        clear_response_headers,
        filter(ctx.get_request().await.is_unknown_method()),
        response_body("unknown_method")
    )]
    async fn handle(self, ctx: &Context) {}
}

The macro should be applied to async functions that accept a &Context parameter.