How to use multiple extensions in the same handler? #112
|
I'm struggling to understand how do I combine multiple extractors in the same handler. It's useful in cases where my apps needs access to the state and something else in a single handler. |
Replies: 1 comment
|
Just to clarify, are you referring to Axum extractors which you would like to use in Qubit handlers? If so, there isn't any specific support for this. It should be possible to manually run extractors on a request with If you're talking about the Ctx parameter passed to Qubit handlers, then only one of these is possible. Qubit's implantation is much simpler than Axum's, as Qubit always assumes that the first parameter is a ctx parameter, and enforces that it implements |
Just to clarify, are you referring to Axum extractors which you would like to use in Qubit handlers?
If so, there isn't any specific support for this. It should be possible to manually run extractors on a request with
FromRequestPartsin the service builder (see auth example for an idea of how to use the raw underlying request). After this, you'd just store the result in the Qubit context that's passed to handlers.If you're talking about the Ctx parameter passed to Qubit handlers, then only one of these is possible. Qubit's implantation is much simpler than Axum's, as Qubit always assumes that the first parameter is a ctx parameter, and enforces that it implements
FromRequestExtensions.