MCPcopy Create free account
hub / github.com/angular/angular / withInterceptorsFromDi

Function withInterceptorsFromDi

packages/common/http/src/provider.ts:185–202  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

183 * @see {@link provideHttpClient}
184 */
185export function withInterceptorsFromDi(): HttpFeature<HttpFeatureKind.LegacyInterceptors> {
186 // Note: the legacy interceptor function is provided here via an intermediate token
187 // (`LEGACY_INTERCEPTOR_FN`), using a pattern which guarantees that if these providers are
188 // included multiple times, all of the multi-provider entries will have the same instance of the
189 // interceptor function. That way, the `HttpINterceptorHandler` will dedup them and legacy
190 // interceptors will not run multiple times.
191 return makeHttpFeature(HttpFeatureKind.LegacyInterceptors, [
192 {
193 provide: LEGACY_INTERCEPTOR_FN,
194 useFactory: legacyInterceptorFnFactory,
195 },
196 {
197 provide: HTTP_INTERCEPTOR_FNS,
198 useExisting: LEGACY_INTERCEPTOR_FN,
199 multi: true,
200 },
201 ]);
202}
203
204/**
205 * Customizes the XSRF protection for the configuration of the current `HttpClient` instance.

Callers 2

provider_spec.tsFile · 0.90
module.tsFile · 0.90

Calls 1

makeHttpFeatureFunction · 0.85

Tested by

no test coverage detected