Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C97D8C0B5 for ; Wed, 17 Jul 2013 08:48:58 +0000 (UTC) Received: (qmail 40499 invoked by uid 500); 17 Jul 2013 08:48:58 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 40230 invoked by uid 500); 17 Jul 2013 08:48:53 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 39730 invoked by uid 99); 17 Jul 2013 08:48:49 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jul 2013 08:48:49 +0000 Date: Wed, 17 Jul 2013 08:48:49 +0000 (UTC) From: "Robin Millette (JIRA)" To: dev@couchdb.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (COUCHDB-1855) POST/GET query is not processing arrays properly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COUCHDB-1855?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13710870#comment-13710870 ] Robin Millette commented on COUCHDB-1855: ----------------------------------------- I couldn't find the ticket earlier, but I was refering to [COUCHDB-1855]. Not looking for an argument either ;-) This was probably my first comment on this issue tracker, and I don't know erlang (yet!) so I will try not to be to noisy. > POST/GET query is not processing arrays properly > ------------------------------------------------ > > Key: COUCHDB-1855 > URL: https://issues.apache.org/jira/browse/COUCHDB-1855 > 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: http://www.atlassian.com/software/jira