Design Patterns · Senior · Question 28 of 75
Why is the order of middleware or interceptors in a chain of responsibility risky?
- ✓Correct answer: The result depends on the order of the handlers
- 2Order doesn't matter - handlers run in parallel
- 3Handlers are always sorted alphabetically automatically
Explanation
Token refresh must come before the retry, caching after authorization, error transformation at the end. The order should be set explicitly in one place and covered by tests.