Design Patterns · Middle · Question 10 of 75
Which pattern do axios interceptors or fetch wrappers implement?
- ✓Correct answer: Chain of Responsibility: the request passes through handlers
- 2Abstract Factory: each interceptor creates a new HTTP client
- 3Singleton: the interceptor guarantees a single active request
Explanation
Interceptors add a token, log, refresh the session on 401, transform errors - each is responsible for its own step and passes the request on. Order matters and should be fixed explicitly.