Introduce a 'custom_converter' to the RouterHandler#30
Introduce a 'custom_converter' to the RouterHandler#30
Conversation
|
hey @bblommers ! can you show me an example of this? i'm open to the idea, conceptually though it should already be covered by custom dispatchers, but i may be missing something, so just would like to see a clarifying practical example in localstack first. |
|
Further discussion on Slack cemented the idea that we (I) should handle this in a custom dispatcher, as the current solution is the wrong abstraction level. |
|
thanks @bblommers, appreciate you reaching out and taking the time to explore other solutions! as discussed, my main issue was that the solution was too specific to the RouterHandler and not native to the Router. the intended way of solving a problem like this is to write a custom dispatcher. however, i conceded that this is a bit difficult given that the router object bert is working with is the gateway my suggestion was to write a custom dispatcher and then replace or wrap the dispatcher of |
Motivation
When using the RouterHandler, Rolo expects the response of individual routes to be a Response object.
However, when used in conjunction with a serializer like the
ASF, individual routes sometimes return a custom object that requires additional serialization down the line.This PR introduces a custom converter at the RouterHandler-level, so that individual routes can continue to return custom objects, and the serialization step (/conversion to a
rolo.Response-object) is centralized in a single utility function.