MCPcopy Create free account
hub / github.com/chridou/http-api-problem / error_response

Method error_response

src/api_error.rs:305–316  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

303#[cfg(feature = "with-actix-web")]
304impl actix_web::error::ResponseError for ApiError {
305 fn error_response(&self) -> actix_web::HttpResponse {
306 let json = self.to_http_api_problem().json_bytes();
307 let actix_status = actix_web::http::StatusCode::from_u16(self.status.as_u16())
308 .unwrap_or(actix_web::http::StatusCode::INTERNAL_SERVER_ERROR);
309
310 actix_web::HttpResponse::build(actix_status)
311 .header(
312 actix_web::http::header::CONTENT_TYPE,
313 PROBLEM_JSON_MEDIA_TYPE,
314 )
315 .body(json)
316 }
317}
318
319#[cfg(feature = "with-warp")]

Callers

nothing calls this directly

Calls 2

json_bytesMethod · 0.80
to_http_api_problemMethod · 0.80

Tested by

no test coverage detected