You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I do see some internals/properties that are unique to the injected request, but I'm hesitant to hook into any internals when it doesn't seem to be documented anyway (not sure if they're stable/safe, etc.). I'm looking for an official way to do this if it's possible.
For a little context, although not very important, I have a handful of routes in my app, but one of them simply does an "internal redirect" to the other handler. I realize I could separate things out into functions and call them outside the scope of a handler, but it's quite messy, and I want all the hooks to run, etc. Is there a better way to do an internal redirect and essentially pass control to another route handler?
EDIT: An alternative would be having a way to possibly pass an object or flag along when calling inject, but that doesn't seem supported either. Basically, I need a way to set some flag, value, config, etc. that can be read from the handler, but that cannot be set on a normal request.
Thanks.
The text was updated successfully, but these errors were encountered:
Wowzers, I'm dumb, lol. I knew Fastify wrapped it, but I was thinking req.raw was one step lower than even light-my-request, so never thought to even try that, but it works. Appreciate the help!
💬 Question here
Is it possible to detect within a hook or handler whether or not the request is a "real" request vs being generated from
fastify.inject()
?I do see some internals/properties that are unique to the injected request, but I'm hesitant to hook into any internals when it doesn't seem to be documented anyway (not sure if they're stable/safe, etc.). I'm looking for an official way to do this if it's possible.
For a little context, although not very important, I have a handful of routes in my app, but one of them simply does an "internal redirect" to the other handler. I realize I could separate things out into functions and call them outside the scope of a handler, but it's quite messy, and I want all the hooks to run, etc. Is there a better way to do an internal redirect and essentially pass control to another route handler?
EDIT: An alternative would be having a way to possibly pass an object or flag along when calling inject, but that doesn't seem supported either. Basically, I need a way to set some flag, value, config, etc. that can be read from the handler, but that cannot be set on a normal request.
Thanks.
The text was updated successfully, but these errors were encountered: