feat(http): provide injection token to inspect configured interceptors by AyushDubey23 · Pull Request #70583 · angular/angular · GitHub
Skip to content

feat(http): provide injection token to inspect configured interceptors - #70583

Open
AyushDubey23 wants to merge 1 commit into
angular:mainfrom
AyushDubey23:feat/http-inspect-interceptors
Open

feat(http): provide injection token to inspect configured interceptors#70583
AyushDubey23 wants to merge 1 commit into
angular:mainfrom
AyushDubey23:feat/http-inspect-interceptors

Conversation

@AyushDubey23

Copy link
Copy Markdown

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Currently, there is no public API or injection token allowing libraries and consumers to inspect which functional HTTP interceptors are configured for an HttpClient instance. This makes it difficult for library authors (such as auth or telemetry packages) to verify or guard against missing required interceptors.

Issue Number: Fixes #57409

What is the new behavior?

Introduces the HTTP_CONFIGURED_INTERCEPTOR_FNS injection token, which resolves to a ReadonlySet<HttpInterceptorFn> containing all functional interceptors configured for the active HttpClient.

Key details:

  • Resolves interceptors configured locally via withInterceptors as well as root-level interceptors (HTTP_ROOT_INTERCEPTOR_FNS).
  • Recursively includes interceptors from parent injectors when withRequestsMadeViaParent() is configured on the client.
  • Enables consuming services/libraries to check interceptor configuration cleanly (e.g. inject(HTTP_CONFIGURED_INTERCEPTOR_FNS).has(myInterceptorFn)).

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Follows the design suggested by @alxhub in #57409 (comment).

Introduce the HTTP_CONFIGURED_INTERCEPTOR_FNS injection token, which
resolves to a ReadonlySet<HttpInterceptorFn> containing all functional HTTP
interceptors configured for the current HttpClient instance.

When withRequestsMadeViaParent() is configured on the current HttpClient,
parent interceptors are recursively included into the set.

Fixes angular#57409
@pullapprove
pullapprove Bot requested a review from atscott September 5, 2026 18:17
@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: common/http Issues related to HTTP and HTTP Client labels Sep 5, 2026
@ngbot ngbot Bot added this to the Backlog milestone Sep 5, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

The http client is provided in root, it should also work without the provide function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: common/http Issues related to HTTP and HTTP Client detected: feature PR contains a feature commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check if a http interceptor is provided

2 participants