(response: st_http::Response)
| 590 | } |
| 591 | |
| 592 | fn 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")] |
| 612 | pub(crate) fn request_from_wire(request: st_http::Request, body: Bytes) -> http::Request<Body> { |
no test coverage detected
searching dependent graphs…