1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

refactor WithHandler trait

This commit is contained in:
Nikolay Kim
2018-03-27 20:33:24 -07:00
parent 62fb75ff95
commit 4358da9926
8 changed files with 103 additions and 49 deletions

View File

@ -31,7 +31,7 @@ fn index(req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {
}
/// This handler uses `With` helper for loading serde json object.
fn extract_item(_: HttpRequest, item: Json<MyObj>) -> Result<HttpResponse> {
fn extract_item(item: Json<MyObj>) -> Result<HttpResponse> {
println!("model: {:?}", &item);
httpcodes::HTTPOk.build().json(item.0) // <- send response
}