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

Is it possible to send arrays in POST requests using Volley? #17

Closed
andrew-k-21-12 opened this issue Apr 7, 2017 · 2 comments
Closed

Comments

@andrew-k-21-12
Copy link

I'm having no luck to perform POST request with an array as param, while Postman and OkHttp are doing it correctly: http://stackoverflow.com/questions/43270880/what-is-a-correct-way-to-send-an-array-in-post-request-using-volley
Is it possible at all to encode arrays for POST requests in Volley?

@jpd236
Copy link
Collaborator

jpd236 commented Apr 7, 2017

All Volley is doing is posting the raw bytes you tell it to in getBody(). If you're not seeing consistent behavior server-side, then dump the bytes of the request from a client that works and figure out what's different.

I don't think there's a Volley issue here. At a glance at your stack overflow post, your implementation of getBody() returns the bytes for this String:

items=247642&categories%5B%5D=12

but your Postman example is returning the bytes for this String:

items=247642&categories%5B%5D=10&categories%5B%5D=9

Unless that was an inadvertent error, then of course the former wouldn't return an array; there's only one "categories" element, whereas the latter has two. If that was just a typo, then dig into the difference in the request bytes as noted above.

@jpd236 jpd236 closed this as completed Apr 7, 2017
@andrew-k-21-12
Copy link
Author

andrew-k-21-12 commented Apr 7, 2017

The difference between two body strings is not very necessary. In fact I have tried both (and many other variants) - all of them with no luck in Volley. I'll try to make a dump of the request body on the server's side, maybe it'll lead me to some fresh idea...

P.S. I can't say that this issue is closed yet.

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

No branches or pull requests

2 participants