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

Function convert_response

crates/bindings/src/http.rs:592–609  ·  view source on GitHub ↗
(response: st_http::Response)

Source from the content-addressed store, hash-verified

590}
591
592fn convert_response(response: st_http::Response) -> http::Result<http::response::Parts> {
593 let st_http::Response { headers, version, code } = response;
594
595 let (mut response, ()) = http::Response::new(()).into_parts();
596 response.version = match version {
597 st_http::Version::Http09 => http::Version::HTTP_09,
598 st_http::Version::Http10 => http::Version::HTTP_10,
599 st_http::Version::Http11 => http::Version::HTTP_11,
600 st_http::Version::Http2 => http::Version::HTTP_2,
601 st_http::Version::Http3 => http::Version::HTTP_3,
602 };
603 response.status = http::StatusCode::from_u16(code)?;
604 response.headers = headers
605 .into_iter()
606 .map(|(k, v)| Ok((k.into_string().try_into()?, v.into_vec().try_into()?)))
607 .collect::<http::Result<_>>()?;
608 Ok(response)
609}
610
611#[cfg(feature = "unstable")]
612pub(crate) fn request_from_wire(request: st_http::Request, body: Bytes) -> http::Request<Body> {

Callers 1

sendMethod · 0.85

Calls 8

into_partsMethod · 0.80
try_intoMethod · 0.80
into_vecMethod · 0.80
newFunction · 0.50
OkFunction · 0.50
mapMethod · 0.45
into_iterMethod · 0.45
into_stringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…