diff --git a/examples/json/src/main.rs b/examples/json/src/main.rs index 34730366e..73863eefd 100644 --- a/examples/json/src/main.rs +++ b/examples/json/src/main.rs @@ -21,7 +21,7 @@ struct MyObj { number: i32, } -/// This handler uses `HttpRequest::json()` for loading serde json object. +/// This handler uses `HttpRequest::json()` for loading json object. fn index(req: HttpRequest) -> Box> { req.json() .from_err() // convert all errors into `Error` @@ -32,7 +32,7 @@ fn index(req: HttpRequest) -> Box> { .responder() } -/// This handler uses `With` helper for loading serde json object. +/// This handler uses json extractor fn extract_item(item: Json) -> HttpResponse { println!("model: {:?}", &item); HttpResponse::Ok().json(item.0) // <- send response @@ -40,7 +40,7 @@ fn extract_item(item: Json) -> HttpResponse { const MAX_SIZE: usize = 262_144; // max payload size is 256k -/// This handler manually load request payload and parse serde json +/// This handler manually load request payload and parse json object fn index_manual(req: HttpRequest) -> Box> { // HttpRequest is stream of Bytes objects req @@ -86,15 +86,18 @@ fn index_mjsonrust(req: HttpRequest) -> Box