fix: serialize 'application/x-www-form-urlencoded' with array indices in browser#1589
fix: serialize 'application/x-www-form-urlencoded' with array indices in browser#1589dsanders11 wants to merge 1 commit intoforwardemail:masterfrom
Conversation
… in browser Match the behavior in node
|
I'm wondering if using a package like https://www.npmjs.com/package/qs would be best, as to ensure consistency regardless of Node/Browser changes, e.g. |
|
@niftylettuce, that package is already used in the Node code, isn't it? I wasn't sure if it plays nice in the browser environment. If so, that seems like a simpler way to go as it would reduce some code and keep them consistent, as you said. |
|
Yeah |
|
@niftylettuce, made PR #1591, which just uses |
|
v6.1.0 has been released to npm, thank you @dsanders11 https://github.com/visionmedia/superagent/releases/tag/v6.1.0 |
This is a quick and dirty PR more for discussion than immediate merging.
Currently the behavior for serializing
application/x-www-form-urlencodedpayloads seems to differ between Node and the browser, with Node using indices for array values and the browser not. This PR tries to make the behavior consistent, with the assumption that the behavior in Node is the intended behavior.So, open question on which environment has the intended behavior currently. I see that in Node indices are turned off for serializing the query string, but not for the payload body when it's
application/x-www-form-urlencoded.