Skip to content
This repository has been 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
chrisnicola opened this issue Jul 23, 2013 · 2 comments
Open

Custom URI encoding makes it hard to mock $http requests #3311

chrisnicola opened this issue Jul 23, 2013 · 2 comments

Comments

@chrisnicola
Copy link
Contributor

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:

  1. Improve the $httpBackend mocking API so it is possible to express the query parameters with an object
  2. Expose the query encoding functions

I'd actually suggest both are good ideas.

@pkozlowski-opensource
Copy link
Member

#10853 should help with (2), review would be appreciated. Going to look into (1) in the coming days.

@dmtintner
Copy link

Is this issue still being worked on? Whats the status?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants