Function ntex::web::guard::All

source ยท
pub fn All<F: Guard + 'static>(guard: F) -> AllGuard
Expand description

Return guard that matches if all of the supplied guards.

use ntex::web::{self, guard, App, HttpResponse};

fn main() {
    App::new().service(web::resource("/index.html").route(
        web::route()
            .guard(
                guard::All(guard::Get()).and(guard::Header("content-type", "text/plain")))
            .to(|| async { HttpResponse::MethodNotAllowed() }))
    );
}