Web Development Angular Subjective
Oct 23, 2025

How do you create and use HTTP interceptors?

Detailed Explanation
Implement HttpInterceptor interface to intercept HTTP requests/responses. Example: @Injectable() export class AuthInterceptor implements HttpInterceptor { intercept(req, next) { const authReq = req.clone({ headers: req.headers.set("Authorization", "Bearer " + token) }); return next.handle(authReq); } }
Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback