MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / respond_to

Method respond_to

examples/rocket_okapi_example/api/src/error.rs:90–98  ·  view source on GitHub ↗
(self, _: &'r Request<'_>)

Source from the content-addressed store, hash-verified

88
89impl<'r> Responder<'r, 'static> for Error {
90 fn respond_to(self, _: &'r Request<'_>) -> response::Result<'static> {
91 // Convert object to json
92 let body = serde_json::to_string(&self).unwrap();
93 Response::build()
94 .sized_body(body.len(), std::io::Cursor::new(body))
95 .header(ContentType::JSON)
96 .status(Status::new(self.http_status_code))
97 .ok()
98 }
99}
100
101impl From<rocket::serde::json::Error<'_>> for Error {

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.80
newFunction · 0.50
statusMethod · 0.45

Tested by

no test coverage detected