You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Example of constructing responses in HTTP method interceptors + typings problem #243
Please provide a simple example of constructing a valid response in a method interceptor.
The ticket #44 refers to something that apparently has been moved, and the example in the README is very general, succinct and I find it not helpful at all.
changed the title [-]Example of constructing responses in HTTP method interceptors[/-][+]Example of constructing responses in HTTP method interceptors + typings problem[/+]on Aug 14, 2019
Activity
arturhun commentedon Aug 14, 2019
By looking into interfaces.d.ts I managed to come up with something like:
Functionally, this seems to work, however:
.utilstype which allegedly doesn't exist on type RequestInfo, it doesn't exist on type string.We have
type RequestInfo = Request | string;but
(reqInfo as Request).utils.still leaves the squiggles underneathutils.The above shows that the docs leave much of guesswork for a developer and it could be avoided by provided a decent example.
vishal423 commentedon Aug 14, 2019
did you check under this directory for examples? https://github.com/angular/in-memory-web-api/tree/master/src/app
[-]Example of constructing responses in HTTP method interceptors[/-][+]Example of constructing responses in HTTP method interceptors + typings problem[/+]arturhun commentedon Aug 14, 2019
OK, the typing problem came from that I didn't have an explicit import from the library and so TypeScript used
RequestInfofromlib.dom.d.tsarturhun commentedon Aug 14, 2019
@vishal423 Yes I did. and the code that I used based on that
didn't work.