Android & Jetpack Compose (50 Qs)•Part 2: Compose Internals, Persistence, DI & Background Work (11 - 24)
What are OkHttp Interceptors (Application vs Network Interceptors)?
senior LevelDocker & ContainersHTTP & REST APIs
In Simple Words: Interceptors inspect, modify, or retry outbound HTTP requests and inbound responses:
- Application Interceptor: Sits between application code and OkHttp. Always invoked once per request; ideal for appending global
Authorization: Bearer <token>headers or logging. - Network Interceptor: Sits between OkHttp and the physical network socket. Observes actual network redirects, caching behavior, and raw wire data.