MCPcopy
hub / github.com/angular/angular / withInterceptorsFromDi

Function withInterceptorsFromDi

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

Source from the content-addressed store, hash-verified

177 * @see {@link provideHttpClient}
178 */
179export function withInterceptorsFromDi(): HttpFeature<HttpFeatureKind.LegacyInterceptors> {
180 // Note: the legacy interceptor function is provided here via an intermediate token
181 // (`LEGACY_INTERCEPTOR_FN`), using a pattern which guarantees that if these providers are
182 // included multiple times, all of the multi-provider entries will have the same instance of the
183 // interceptor function. That way, the `HttpINterceptorHandler` will dedup them and legacy
184 // interceptors will not run multiple times.
185 return makeHttpFeature(HttpFeatureKind.LegacyInterceptors, [
186 {
187 provide: LEGACY_INTERCEPTOR_FN,
188 useFactory: legacyInterceptorFnFactory,
189 },
190 {
191 provide: HTTP_INTERCEPTOR_FNS,
192 useExisting: LEGACY_INTERCEPTOR_FN,
193 multi: true,
194 },
195 ]);
196}
197
198/**
199 * 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…