Skip to content

Polluted HTTP_INTERCEPTOR in child modules #39125

Closed
@matheo

Description

@matheo

🐞 bug report

Affected Package

The issue is caused by package @angular/common/http

Is this a regression?

No, it seems an issue by design.
Some thoughts about this are shared in #36974

Description

Providing HTTP_INTERCEPTOR seems tricky.

What we expect:
Inherit the interceptors from the root module if you haven't configured anything in the child module.

What we get:
a dummy HttpXsrfInterceptor injected in the child modules, overriding the defined ones.

🔬 Minimal Reproduction

https://matheo.github.io/ng-providers/

Angular 9: https://github.com/matheo/ng-providers/tree/819c17bb2587e0192c6d30f49b32844e6c39c3ca
Angular 10: https://github.com/matheo/ng-providers/tree/68746d996916fea5c408071848ed44eb7c26af9a

🔥 Exception or Error

It causes problems on code relying on Custom Interceptors,
and it should not pollute the child module interceptors right?

🌍 Your Environment


Angular CLI: 10.1.4
Node: 10.22.0
OS: linux x64

Angular: 10.1.4
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: 

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1001.4
@angular-devkit/build-angular   0.1001.4
@angular-devkit/core            10.1.4
@angular-devkit/schematics      10.1.4
@angular/cdk                    10.2.4
@angular/flex-layout            10.0.0-beta.32
@angular/material               10.2.4
@schematics/angular             10.1.4
@schematics/update              0.1001.4
rxjs                            6.6.2
typescript                      4.0.3

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functionsarea: common/httpIssues related to HTTP and HTTP ClientfeatureIssue that requests a new featurefeature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authorsfeature: votes requiredFeature request which is currently still in the voting phaseneeds: clarificationThis issue needs additional clarification from the reporter before the team can investigate.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions