MCPcopy Index your code
hub / github.com/clawshell/clawshell / into_response

Method into_response

src/proxy.rs:283–294  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

281
282impl 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)]

Calls

no outgoing calls