DEV Community

Discussion on: Angular Http Mock Interceptor for mocked backend

Collapse
sanidz profile image
sanidz Author

Well, it is just a regular Angular Service, so it can intercept all requests coming from that app.

However if those requests are coming from another app you could just:
1 start local json server and mock needed google.apis
2 edit google api urls to hit new local mocked ones or if not possible
2.a edit hosts file so that your local json server acts and responds to all existing and real google api urls.

github.com/typicode/json-server

It also depends which e2e tests, cypress for example has full suport for endpoint mocking and could mock all requests out of the box :)