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
Get parameter array with key value #1093
Comments
Hi @ghprod, first of all I want to make clear that I'm not a contributor to this library nor I use it, but I was passing by and I saw this issue and decided to investigate the code a bit. Axios does not support that kind of encoding by default but it allows you to provide a custom serializer. You can accomplish this very easily with the following code: // Axios include here...
axios.get('/user', {
params: {
filter: {post: 3, author: 12}
},
paramsSerializer: customSerializerFunc
}); To make it simpler, I googled a bit for querystring serializer libraries and found qs which has support for browsers and nodejs. You can use it as a serializer this way: // Include axios and qs here...
axios.get('/user', {
params: {
filter: {post: 3, author: 12}
},
paramsSerializer: qs.stringify // If this doesnt work, append .bind(qs) to the end of this line.
}); Maybe you'll see this: axios.get('/user', {
params: {
filter: {post: 3, author: 12}
},
paramsSerializer: function(params) {
return qs.stringify(params, { encode: false });
}
}); Let me know if it worked. |
It's works .. 👍 Thanks a lot @ngonzalvez Have a great day :) |
hi, i need help regarding axios -- how do i get a value from input and put it as a value on a parameter for axios.get ; say for a search function that i am building - part of the url is a query param. here's the code where hint = "searchText" please help. thanks! |
Hi,
I've searching, but can't find the way to do it. Basically i want to send GET request with array parameter like this
I've tried this
But still no luck :(
Any hint?
Thanks
The text was updated successfully, but these errors were encountered: