tezvyn:

Angular HttpInterceptor: A Pipeline for API Requests

Source: angular.devintermediate

Think of an HttpInterceptor as a pipeline for every API call, letting you inspect or modify requests and responses globally. Use it to automatically add auth headers or show a loading spinner.

An Angular HttpInterceptor is like a middleware pipeline for your API calls. Each request passes through this chain, letting you centrally inspect, modify, or handle it without cluttering your services. It's perfect for cross-cutting concerns like adding auth tokens, logging traffic, or showing a loading spinner. The footgun: interceptor order is critical, and requests are immutable, so you must use the `.clone()` method to apply any changes.

Read the original → angular.dev

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Angular HttpInterceptor: A Pipeline for API Requests · Tezvyn