(self, _: &'r Request<'_>)
| 88 | |
| 89 | impl<'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 | |
| 101 | impl From<rocket::serde::json::Error<'_>> for Error { |