use axum::response::{IntoResponse, Response}; use bytes::BytesMut; use conduit::Error; use http::StatusCode; use http_body_util::Full; use ruma::api::{client::uiaa::UiaaResponse, OutgoingResponse}; pub(crate) struct RumaResponse(pub(crate) T); impl From for RumaResponse { fn from(t: Error) -> Self { Self(t.into()) } } impl IntoResponse for RumaResponse { fn into_response(self) -> Response { match self.0.try_into_http_response::() { Ok(res) => res.map(BytesMut::freeze).map(Full::new).into_response(), Err(_) => StatusCode::INTERNAL_SERVER_ERROR.into_response(), } } }