-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Providing an array as a param isn't working as expected. #604
Comments
According to this test it seems to be the expected behavior. |
I'll look into that, thank you. |
Hi @stsourlidakis , I am trying to use I set: //front-end
axios.delete(url,
{paramsSerializer: accountsInfo } //--> paramsSerializer
).then(
(res) => {
.....
}
) My back-end environment is //front-end
axios.delete(`url/${array}`).then(
(res) => {...}
)
//back-end
handleDelete = async(ctx, next) => {
let arrayString = ctx.params.array;
} if I use //front-end
axios.patch(url, data).then(
(res) => {...}
)
//back-end
handlePatch = async(ctx, next) => {
let data = ctx.request.body.data;
...
} So I can get |
this should helps
|
Thank you @kmmbvnr , but I'd rather this was a built-in behavior when handling arrays (checkbox values) PS: @GetMapping()
public String search(@RequestParam(name = "country[]") String[] country) |
and
get options |
Refactoring @AndreyPatseiko 's answer to ES6+ style:
and
BTW, thank you, @AndreyPatseiko! Your answer helped me a lot! |
This is better |
@jorge683 that generates incorrect query |
Hi,
I attempting to use the USDA Food Composition Database's API to access nutritional information. I want to put in the following get request using axios config.params object:
This is my code for the axios.get request:
But when I get the response, I see that the built url becomes:
Is this meant to happen? Do other APIs adhere to this format? If so, is there a way to avoid the insertion of '[]' after each 'nutrients' param, so that I may get around this issue for this specific API?
The text was updated successfully, but these errors were encountered: