Function actix_web::pred::All[][src]

pub fn All<S: 'static, P: Predicate<S> + 'static>(pred: P) -> AllPredicate<S>

Return predicate that matches if all of supplied predicate matches.

use actix_web::{pred, App, HttpResponse};

fn main() {
    App::new().resource("/index.html", |r| {
        r.route()
            .filter(
                pred::All(pred::Get())
                    .and(pred::Header("content-type", "text/plain")),
            )
            .f(|_| HttpResponse::MethodNotAllowed())
    });
}