MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / from_request

Method from_request

crates/client-api/src/util.rs:28–38  ·  view source on GitHub ↗
(req: Request, state: &S)

Source from the content-addressed store, hash-verified

26 type Rejection = axum::response::Response;
27
28 async fn from_request(req: Request, state: &S) -> Result<Self, Self::Rejection> {
29 let bytes = Bytes::from_request(req, state)
30 .await
31 .map_err(IntoResponse::into_response)?;
32
33 let string = bytes
34 .try_into()
35 .map_err(|_| (StatusCode::BAD_REQUEST, "Request body didn't contain valid UTF-8").into_response())?;
36
37 Ok(ByteStringBody(string))
38 }
39}
40
41pub struct XForwardedFor(pub IpAddr);

Callers

nothing calls this directly

Calls 6

ByteStringBodyClass · 0.85
try_intoMethod · 0.80
OkFunction · 0.50
ErrFunction · 0.50
into_responseMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected