Making real requests to HTTP server in AngularJS unit/integration tests
问题 Making a request that wasn't mocked with $httpBackend.when in Angular 1.x unit/integration test results in an error: Error: Unexpected request: GET /real-request Is it possible to make real HTTP requests with ngMock and Karma+Jasmine test rig? What is a good practice to do that? 回答1: AngularJS is opinionated framework, and its opinion on HTTP requests in unit tests is that all of them should be mocked. It is not advisable to do real HTTP requests in unit tests for two reasons. Unit tests are