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

Function withRequestsMadeViaParent

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

Source from the content-addressed store, hash-verified

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

Callers 1

provider_spec.tsFile · 0.90

Calls 2

injectFunction · 0.90
makeHttpFeatureFunction · 0.85

Tested by

no test coverage detected