Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redundant encodeURIComponent #5

Closed
nelsonec87 opened this issue Dec 6, 2016 · 4 comments
Closed

redundant encodeURIComponent #5

nelsonec87 opened this issue Dec 6, 2016 · 4 comments
Labels
Milestone

Comments

@nelsonec87
Copy link

Hi, I'm playing with your lib (super cool) and I tried to send a Query parameter using

@Query("$size")
It means the page size in APISpark.
It was not working... I checked the network tab in Chrome and the lib was sending "%2524size" which is "$size" URLEncoded twice.

I removed encodeURIComponent from util.js

search.set(encodeURIComponent(key), encodeURIComponent(value));

and it worked.

I put other special characters to test and it encoded them automatically.

@hboylan hboylan added the bug label Dec 6, 2016
@hboylan
Copy link
Owner

hboylan commented Dec 6, 2016

Hey, good find!

Looks like the URLSearchParams class from @angular/http now encodes them for us. We'll definitely get this fixed and tested ASAP.

@nelsonec87
Copy link
Author

Thanks for the really quick response!
I know it is not the place, but i dont wanna open another issue without knowing if it is your module's problem or some CORS config... A cannot access custom headers from the response. (X-Page-Count, etc)

I get
image
in the network inspector, but in the console the headers' size is 1:

image

hboylan pushed a commit that referenced this issue Dec 12, 2016
@hboylan
Copy link
Owner

hboylan commented Dec 12, 2016

Fixed this issue with v0.0.3

I can confirm that only certain headers show up for some reason. It's pulling the @angular/http Headers from Response so that's a better place to research the problem.

I'd be interested to know the reason if you find out.

@hboylan hboylan closed this as completed Dec 12, 2016
@nelsonec87
Copy link
Author

Updated to 0.0.3, thanks.

The header issue is related to CORS... when I run the interface from the same host:port it works as it should.
In cross domain requests, the server must white-list the headers the browser can access:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Access-Control-Expose-Headers

@hboylan hboylan added this to the 1.0.0 milestone Jul 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants