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

simplify middleware api; fix examples

This commit is contained in:
Nikolay Kim
2017-11-26 21:47:33 -08:00
parent 5a3b6638a7
commit fdafb0c848
11 changed files with 74 additions and 64 deletions

View File

@ -9,7 +9,7 @@ use std::io::Read;
use actix_web::*;
/// somple handle
fn index(req: &mut HttpRequest, _payload: Payload, state: &()) -> HttpResponse {
fn index(req: HttpRequest) -> HttpResponse {
println!("{:?}", req);
httpcodes::HTTPOk
.builder()
@ -36,7 +36,7 @@ fn main() {
// register simple handler, handle all methods
.handler("/index.html", index)
// with path parameters
.resource("/", |r| r.handler(Method::GET, |req, _, _| {
.resource("/", |r| r.handler(Method::GET, |req| {
Ok(httpcodes::HTTPFound
.builder()
.header("LOCATION", "/index.html")