withRequestsMadeViaParent
Configures the current HttpClient
instance to make requests via the parent injector's
HttpClient
instead of directly.
function withRequestsMadeViaParent(): HttpFeature<HttpFeatureKind.RequestsMadeViaParent>;
withRequestsMadeViaParent
Configures the current HttpClient
instance to make requests via the parent injector's
HttpClient
instead of directly.
By default, provideHttpClient
configures HttpClient
in its injector to be an independent
instance. For example, even if HttpClient
is configured in the parent injector with
one or more interceptors, they will not intercept requests made via this instance.
With this option enabled, once the request has passed through the current injector's
interceptors, it will be delegated to the parent injector's HttpClient
chain instead of
dispatched directly, and interceptors in the parent configuration will be applied to the request.
If there are several HttpClient
instances in the injector hierarchy, it's possible for
withRequestsMadeViaParent
to be used at multiple levels, which will cause the request to
"bubble up" until either reaching the root level or an HttpClient
which was not configured with
this option.