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

Return guard that matches if all of the supplied guards.

use actix_web::{guard, web, 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(|| HttpResponse::MethodNotAllowed()))
    );
}