Passing options with UseInterceptor #860
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When using routing controllers, I don't want to explicitly set an interceptor to each controller action even though I (might) want to specify the priority, in how they're applied to the controller action.
For example; I have a:
When I now specify the flush interceptor on global or controller level, it only get's executed after my response has been formatted. I want the flush to happen before any controller action response formatting happens, without having to specify the flush interceptor, on every controller action, below the response formatting interceptor.
This PR suggests a way to pass and specify options (in this case mostly for the priority prop) to the interceptors, and sorts them according to importance before being applied to each controller action.
This PR still requires tests and additional docs, but I want to get some opinions whether this is something that could be merged.
Local development setup used: #861
Project I tested this with (above setup required): https://github.com/driescroons/routing-controllers-interceptor-priority-testing
Checklist
Update index.md
)develop
)npm run prettier:check
passesnpm run lint:check
passes