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

Function withRequestsMadeViaParent

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

Source from the content-addressed store, hash-verified

281 * @publicApi 19.0
282 */
283export function withRequestsMadeViaParent(): HttpFeature<HttpFeatureKind.RequestsMadeViaParent> {
284 return makeHttpFeature(HttpFeatureKind.RequestsMadeViaParent, [
285 {
286 provide: HttpBackend,
287 useFactory: () => {
288 const handlerFromParent = inject(HttpHandler, {skipSelf: true, optional: true});
289 if (ngDevMode && handlerFromParent === null) {
290 throw new Error(
291 'withRequestsMadeViaParent() can only be used when the parent injector also configures HttpClient',
292 );
293 }
294 return handlerFromParent;
295 },
296 },
297 ]);
298}
299
300/**
301 * Configures the current `HttpClient` instance to make requests using the fetch API.

Callers 2

provider_spec.tsFile · 0.90

Calls 2

injectFunction · 0.90
makeHttpFeatureFunction · 0.85

Tested by

no test coverage detected