1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 09:59:21 +02:00

introduce route predicates

This commit is contained in:
Nikolay Kim
2017-12-04 13:32:05 -08:00
parent 57fd35ffc1
commit 3bf3738e65
20 changed files with 370 additions and 122 deletions

View File

@ -16,7 +16,7 @@ fn create_server<T, A>() -> HttpServer<T, A, Application<()>> {
HttpServer::new(
vec![Application::default("/")
.resource("/", |r|
r.handler(Method::GET, |_| httpcodes::HTTPOk))
r.route().method(Method::GET).handler(|_| httpcodes::HTTPOk))
.finish()])
}
@ -94,7 +94,7 @@ fn test_middlewares() {
response: act_num2,
finish: act_num3})
.resource("/", |r|
r.handler(Method::GET, |_| httpcodes::HTTPOk))
r.route().method(Method::GET).handler(|_| httpcodes::HTTPOk))
.finish()])
.serve::<_, ()>("127.0.0.1:58904").unwrap();
sys.run();