pub fn fn_guard<F>(f: F) -> impl GuardExpand description
Create guard object for supplied function.
use ntex::web::{self, guard, App, HttpResponse};
fn main() {
App::default().service(web::resource("/index.html").route(
web::route()
.guard(
guard::fn_guard(
|req| req.headers()
.contains_key("content-type")))
.to(async || { HttpResponse::MethodNotAllowed() }))
);
}