MCPcopy Create free account
hub / github.com/actix/examples / extract_item

Function extract_item

json/json/src/main.rs:17–22  ·  view source on GitHub ↗

This handler uses json extractor with limit

(item: web::Json<MyObj>, req: HttpRequest)

Source from the content-addressed store, hash-verified

15
16/// This handler uses json extractor with limit
17async fn extract_item(item: web::Json<MyObj>, req: HttpRequest) -> HttpResponse {
18 println!("request: {req:?}");
19 println!("model: {item:?}");
20
21 HttpResponse::Ok().json(item.0) // <- send json response
22}
23
24/// This handler manually load request payload and parse json object
25async fn index_manual(body: web::Bytes) -> Result<HttpResponse, Error> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected