Docs confusion: issue with using querystring with axios
See original GitHub issueIn docs for axios I see this:
In node.js, you can use the querystring module as follows:
var querystring = require(‘querystring’); axios.post(‘http://something.com/’, querystring.stringify({ foo: ‘bar’ }));
I tried this and it didn’t work for me. Later I found this ticket which still open: https://github.com/axios/axios/issues/362
And I think I know why it’s still open…
“querystring.stringify” works different from “qs.stringify”. See this ticket: https://github.com/nodejs/node-v0.x-archive/issues/1665
See:
first querystring:
$ node -e "console.log(require('querystring').stringify({a:{b: 1, c: 2}}));"
$ a=
then qs:
$ node -e "console.log(require('qs').stringify({a:{b: 1, c: 2}}));"
$ a%5Bb%5D=1&a%5Bc%5D=2
querystring doesn’t support nested objects.
What I suggest:
- Make a note in axios documentation to explicitly let people know that “querystring.stringify” doesn’t stringify nested objects.
- After that I think you can close this ticket: https://github.com/axios/axios/issues/362
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top GitHub Comments
@wasnlosdu Sure. Will do it
Done