Write proper Responder #7

Open
opened 2021-12-29 20:16:59 +01:00 by Jef Roosens · 0 comments

We currently just use the built-in Rocket responders for most things, but those have multiple drawbacks:

  • If a backend operation fails, the response gets handled by the default error handler instead of us
  • We can't support muliple serialisation types

Both these issues could be solved by writing our own responder struct that implements the Responder trait. This would allow us to still have control over the content of our message, even if the backend operations fail. We could just make the responder itself never fail, allowing us to fully control the output of our APIs.

We currently just use the built-in Rocket responders for most things, but those have multiple drawbacks: * If a backend operation fails, the response gets handled by the default error handler instead of us * We can't support muliple serialisation types Both these issues could be solved by writing our own responder struct that implements the Responder trait. This would allow us to still have control over the content of our message, even if the backend operations fail. We could just make the responder itself never fail, allowing us to fully control the output of our APIs.
Jef Roosens added the
enhancement
label 2021-12-29 20:16:59 +01:00
Sign in to join this conversation.
There is no content yet.