Skip to content
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

Enable Request Modifiers to short circuit and returning ResponseWrapper #730

Open
minizilla opened this issue Aug 22, 2024 · 0 comments · May be fixed by #731
Open

Enable Request Modifiers to short circuit and returning ResponseWrapper #730

minizilla opened this issue Aug 22, 2024 · 0 comments · May be fixed by #731

Comments

@minizilla
Copy link

minizilla commented Aug 22, 2024

Is your feature request related to a problem? Please describe.

Request modifiers can only inspect and modify requests

Why limiting to that? I have a case where need to short circuit with some logic, but only after KrakenD auth/validator runs. This can be done in plugin/http-client but don't want to touch plugin/http-client. I can't do it in plugin/http-server since it runs before auth/validator. So the perfect place is to Request Modifiers, implement some logic there and if needed short circuit by returning ResponseWrapper (you can simulate this by returning error but can't sending headers in this case, also the logs will show errors too which not desireable).

Describe the solution you'd like
Propose to allow Request Modifiers to return ResponseWrapper to indicating it is a shortcircuit, the Request Modifiers will act like Response Modifiers in this case. These are the characteristic that follows:

  1. If Request Modifiers returning ResponseWrapper, stop the request modifiers executor and return the modified request and the response.
  2. If Response Modifiers exists, execute the response modifiers using the above response.
@minizilla minizilla changed the title Enable Request Modifiers to short circuit without error Enable Request Modifiers to short circuit and returning ResponseWrapper Aug 26, 2024
@minizilla minizilla linked a pull request Aug 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant