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

Method call

middleware/various/src/read_request_body.rs:52–68  ·  view source on GitHub ↗
(&self, mut req: ServiceRequest)

Source from the content-addressed store, hash-verified

50 dev::forward_ready!(service);
51
52 fn call(&self, mut req: ServiceRequest) -> Self::Future {
53 let svc = self.service.clone();
54
55 Box::pin(async move {
56 // extract bytes from request body
57 let body = req.extract::<web::Bytes>().await.unwrap();
58 println!("request body (middleware): {body:?}");
59
60 // re-insert body back into request to be used by handlers
61 req.set_payload(bytes_to_payload(body));
62
63 let res = svc.call(req).await?;
64
65 println!("response: {:?}", res.headers());
66 Ok(res)
67 })
68 }
69}
70
71fn bytes_to_payload(buf: web::Bytes) -> dev::Payload {

Callers

nothing calls this directly

Calls 1

bytes_to_payloadFunction · 0.70

Tested by

no test coverage detected