Skip to content

Enable Request Modifiers to short circuit and returning ResponseWrapper #730

@smoothprogrammer

Description

@smoothprogrammer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions