NG.VII · Angular 22 practice question
In an interceptor running with the fetch backend, how can you check whether an incoming HTTP response was the result of a redirect?
Check answer and explanation
Correct answer: Inspect the response's redirected property.
Explanation
When HttpClient uses the fetch backend, responses include a redirected property aligned with the native Fetch API that indicates whether a redirect occurred.
Common trap
A redirected request often ends with a final 200 OK response, so checking status === 200 cannot tell you if a redirect happened. There is no isRedirected() method on HttpResponse; redirect status is exposed as the redirected property.
Source: Angular docs: Interceptors — Working with redirect information
Checked against the cited text on 2026-11-25.