Skip to content

HTTP Interceptors

Interceptors sit between your app and the server, inspecting/modifying requests and responses.

  • Adding auth tokens
  • Error handling
  • Request/response logging
  • Loading indicators
  • Caching
export const authInterceptor: HttpInterceptorFn = (req, next) => {
const token = inject(AuthService).getToken();
const cloned = token
? req.clone({ setHeaders: { Authorization: `Bearer ${token}` } })
: req;
return next(cloned);
};

Interceptors provide centralized HTTP request/response processing.”