This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Custom URI encoding makes it hard to mock $http requests #3311
Open
Description
I'm having a hell of a time trying to mock $http with $httpBackend. Basically if you are mocking GET, JSONP or DELETE requests, the only way to mock them is to actually express the full URI including the query. However this gets quite challenging because Angular uses it's own query encoding functions which do not appear to be publicly accessible.
The only solution I have for now is to hard-code the URI in my test.
I'd suggest one of two solutions:
- Improve the $httpBackend mocking API so it is possible to express the query parameters with an object
- Expose the query encoding functions
I'd actually suggest both are good ideas.