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

x-www-form-urlencoded data is encoded using URL encoding #85

Open
XuluWarrior opened this issue Dec 11, 2016 · 4 comments
Open

x-www-form-urlencoded data is encoded using URL encoding #85

XuluWarrior opened this issue Dec 11, 2016 · 4 comments

Comments

@XuluWarrior
Copy link

This almost certainly isn't a real problem but as I was debugging my queries I noticed that space characters in form data are encoded as %20 rather than +

http://stackoverflow.com/questions/1211229/in-a-url-should-spaces-be-encoded-using-20-or

Before I discovered popsicle I was using my own hacked up promised web session code and I ended up using the form-urlencoded package for my encoding. But my decision was based on using the first package I found rather than any careful analysis.

@blakeembrey
Copy link
Member

Wow, it sounds like you are working with some legacy systems! Do you mind if I ask what isn't accepting this? Encoding it yourself instead of the internal is very straightforward, thankfully, but I'll do an analysis of what it would take to do + instead.

@blakeembrey
Copy link
Member

Some initial research: It seems other libraries like request and superagent don't do this - https://github.com/request/request/blob/9f702bf4b5d075035c28eea55dda44d3a0235926/lib/querystring.js and https://github.com/ljharb/qs/blob/8aa9c26f90335b5483a4f456dea9acbada8a881c/lib/utils.js#L86 are the methods that get invoked, neither are handling the space correctly. I'll look at formatting according to https://url.spec.whatwg.org/#urlencoded-serializing when I get the chance, if there's minimal overhead to doing so.

@XuluWarrior
Copy link
Author

Sorry I should have made it more clear. This hasn't actually caused me an issue. It was just that when debugging I noticed the difference between my node code and my browser.
I don't know enough about the http specs to know if this is likely to ever cause a real problem but I thought I would point it out and leave it to your judgement.

@blakeembrey
Copy link
Member

Sounds good. I don't think it'll hurt to try and follow the spec though, so I'll check it out.

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

No branches or pull requests

2 participants