couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Millette (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-1855) POST/GET query is not processing arrays properly
Date Tue, 16 Jul 2013 16:34:49 GMT


Robin Millette commented on COUCHDB-1855:

Arrays are supported in view parameters ("keys" is an array, for instance), but the format
must be JSON encoded. Also, the rewriter doesn't support this specific case (say you want
to passthru a user defined argument ("bob") and the preset "joe", url?keys=["bob","joe"] works
but [":username","joe"] doesn't.

When this issue gets fixed, the rewriter should also be improved to support it. Perhaps there
is some opportunity to lift the json encoding requirement on view arguments?

> POST/GET query is not processing arrays properly
> ------------------------------------------------
>                 Key: COUCHDB-1855
>                 URL:
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Andrew Spode Miller
>            Priority: Minor
> Sending an array in POST/GET url encoded form is not working correctly.
> For example:
> ?foo[]=bar&foo[]=bar2
> OR
> ?foo[0]=bar&foo[1]=bar2
> OR 
> ?foo=bar&foo=bar2
> Should be converted to:
> foo = ["bar", "bar2"]
> Instead, the last element overwrites it. So in the above example, excluding the 2nd variety,
you would get:
> foo = "bar2"
> I can't find a W3C document to back up this behaviour - but certainly in PHP and Java,
this is normal behaviour. jQuery also converts an array into this format too, so if it's not
"standard" it's certainly expected.
> According to "rnewson" who I was chatting to on IRC - the reason this is happening is
that the URL query is being converted to a JSON object. Therefore, two items with the same
key name would overwrite each other. He also says the following:
> "yes, I think you'd want to convert "foo=bar&foo=baz" into "foo":["bar","baz"] instead
of [{"foo","bar"},{"foo","baz"}] in couch_httpd_external's to_json_terms function."
> I have put a work around in my own code, so this isn't a priority for me - but perhaps
if someone else already has the relevant bit of code open... :)

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message