Angular 12 support HttpInterceptor Context
ngehlert opened this issue ยท 4 comments
Describe the problem you'd like to have solved
Currently it is only possible to set up rules for allowedDomains or disallowedRoutes. However it is not possible to control the interceptor for one specific HttpClient.get/post/put/delete/... method.
In a current project I have the scenario where I want to request an api endpoint. And I have a DemoInterceptor in place that mocks the same result so no request is actually being made (but all angular interceptors are being called anyway). If a user that is not logged in is using the mocked version for a demo example there is an error from the throwNoTokenError
setting.
A more fine grained control over the token adding to requests would be nice
Describe the ideal solution
Angular 12 adds support for Interceptor Context Blog Article from Net Basal. This would give the possibility to disable the token adding on each specific HttpClient usage while the general module definitions can still be in place.
Alternatives and current work-arounds
I don't think there is a current workaround besides deactive throwNoTokenError
could maybe provide a PR if this would be accepted
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! ๐โโ๏ธ
ping :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! ๐โโ๏ธ