-
Notifications
You must be signed in to change notification settings - Fork 575
Description
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:
- If Request Modifiers returning
ResponseWrapper
, stop the request modifiers executor and return the modified request and the response. - If Response Modifiers exists, execute the response modifiers using the above response.