-
Notifications
You must be signed in to change notification settings - Fork 474
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
Cannot post duplicate values (arrays) with agent.post #132
Comments
What's the correct way to post an array with Mechanize? |
Mechanize does not currently grok multiple values in an array. Instead, request methods take an array of pairs as parameters, so you could do as follows:
If you have other parameters:
I'll be working on improving this situation when I get the time. |
It seems pretty popular to be able to pass a hash also, like |
Thanks, the array of pairs way worked for me |
It seems PHP's http_build_query() is not very compatible with how an array of values assigned to one key is encoded by other well-known implementations of perl, ruby and python.
(And it seems fine to encode brackets) So, what I have in mind now is:
and maybe
|
Closing this as the original problem is solved. |
I've just implemented array/hash value support for query/post parameters. |
Attempt (doesn't work):
page = agent.post(url, {"array[]"=> ["element1", "element2"]})
The equivalent curl invocation (works):
curl -d url "array[]=element1&array[]=element2"
The text was updated successfully, but these errors were encountered: