-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make the user request and response available in skipToNextHandlerFilter #409
base: master
Are you sure you want to change the base?
make the user request and response available in skipToNextHandlerFilter #409
Conversation
Hey @raphaeleidus, so I can understand what we're solving for here, would you describe your use case in a little more detail? Specifically, curious why you engage the proxy function. Overall, the code looks good and I appreciate the attention to tests. |
Yeah sure. So I have a legacy application that I am progressively migrating away from. Currently my new application knows how to render and respond to some requests but it doesn't know based on URL structure only after looking up the object in the database. So currently the my two varieties of request handling flows look like this:
Or
Unfortunately for my end user the lookup can be slow and isn't actually needed for the proxy to succeed. So I would like to do the two steps in parallel edit: will make a diagram to make this clearer |
Thanks for this detailed flow (and all the recent activity). I’ll get back to this on Monday.
Nik
… On Mar 11, 2019, at 9:52 AM, Raphael Eidus ***@***.***> wrote:
So here is a flow diagram. Basically as it stands now I have to do the DB lookup before I make the proxy request. I would like to do them concurrently and discard the proxy response if I dont need it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@raphaeleidus Many thanks for your detailed discussion so far on this. I want to solve for this use case, but I'm conservative about expanding args, and I'm not sure yet that this is the solution I want. I'd be really happy if you want to talk this through with me. This solution makes this method more muscular, and gives an implementer more powerful choices about what to do inside the skipToNext handler. That's a very valid solution, and it works right away to solve your use case, which is valuable. As a general design goal, I keep the steps low wattage on purpose, and give each step a specific and limited role. Part of this is limiting arguments to the narrowest possible scope. In a way, this solution expands the purpose and surface area of skipToNextHandler, and that's what I feel conservative about. I want to see if there's a way to define the problem a little differently before expanding the signature. I'd prefer a solution that lets Is there a signal that Maybe skip should be later? Maybe it actually an additional workflow step? Maybe its what I'm just spitballing for discussion right now; it might resolve to what you've already implemented. I'm interested in your thoughts about this if you're game to discuss. Thanks again. |
Hey @monkpow I would love to discuss this more I do have an idea or two here of some other patterns. I am away on vacation right now but maybe we can do a quick call and talk through some stuff next week if you are up for it. I am in UTC-4 timezone (NYC) |
update the api of
skipToNextHandlerFilter
to befunction(proxyRes, userReq, userRes) {}
I have a use case where I need to skip the proxy but not based on the response of the proxy.
This change is backwards compatible with the existing api