(self)
| 281 | |
| 282 | impl IntoResponse for ProxyError { |
| 283 | fn into_response(self) -> Response { |
| 284 | let (status, message) = match self { |
| 285 | ProxyError::Upstream(msg) => (axum::http::StatusCode::BAD_GATEWAY, msg), |
| 286 | ProxyError::Internal(msg) => (axum::http::StatusCode::INTERNAL_SERVER_ERROR, msg), |
| 287 | ProxyError::MethodNotAllowed(method) => ( |
| 288 | axum::http::StatusCode::METHOD_NOT_ALLOWED, |
| 289 | format!("Method not allowed: {}", method), |
| 290 | ), |
| 291 | }; |
| 292 | let body = serde_json::json!({ "error": message }); |
| 293 | (status, axum::Json(body)).into_response() |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | #[cfg(test)] |
no outgoing calls