From 0cde8603dac7e2e0c0565f582b756fda918848d9 Mon Sep 17 00:00:00 2001 From: Viktor Kojouharov Date: Fri, 29 Aug 2014 12:27:34 +0300 Subject: [PATCH 1/5] Treat array parameter values as miltivalue parameters --- core-xhr.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core-xhr.html b/core-xhr.html index 8557aec..967cb18 100644 --- a/core-xhr.html +++ b/core-xhr.html @@ -77,7 +77,13 @@ for (var n in params) { var v = params[n]; n = encodeURIComponent(n); - r.push(v == null ? n : (n + '=' + encodeURIComponent(v))); + if (Array.isArray(v)) { + v.forEach(function(val) { + r.push(val == null ? n : (n + '=' + encodeURIComponent(val))); + }); + } else { + r.push(v == null ? n : (n + '=' + encodeURIComponent(v))); + } } return r.join('&'); }, From 003e6d3f09af9c8006164294392a4c9f79625b23 Mon Sep 17 00:00:00 2001 From: Viktor Kojouharov Date: Sat, 1 Nov 2014 12:51:02 +0200 Subject: [PATCH 2/5] Add a test for multi-value parameters --- tests/html/core-ajax.html | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/html/core-ajax.html b/tests/html/core-ajax.html index 318d052..0c4fd27 100644 --- a/tests/html/core-ajax.html +++ b/tests/html/core-ajax.html @@ -11,7 +11,7 @@ core-ajax - + @@ -21,20 +21,35 @@ + + From 1b90ccf86ad5378abefcb97f9ed4b03e3d507cc4 Mon Sep 17 00:00:00 2001 From: garlicnation Date: Wed, 5 Nov 2014 18:09:58 -0800 Subject: [PATCH 3/5] Add new test for multivalued parameters. --- test/core-ajax-multivalue.html | 42 ++++++++++++++++++++++++++++++++++ test/index.html | 3 ++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 test/core-ajax-multivalue.html diff --git a/test/core-ajax-multivalue.html b/test/core-ajax-multivalue.html new file mode 100644 index 0000000..960cf1d --- /dev/null +++ b/test/core-ajax-multivalue.html @@ -0,0 +1,42 @@ + + + + + core-ajax + + + + + + + + + + + + + diff --git a/test/index.html b/test/index.html index 93161c3..4e0a19e 100644 --- a/test/index.html +++ b/test/index.html @@ -8,9 +8,10 @@ From 905f94f8a82c891ee928ff2ed9601cae2a159c85 Mon Sep 17 00:00:00 2001 From: garlicnation Date: Wed, 5 Nov 2014 18:11:39 -0800 Subject: [PATCH 4/5] Whitespace cleanup. --- test/core-ajax-multivalue.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core-ajax-multivalue.html b/test/core-ajax-multivalue.html index 960cf1d..e555676 100644 --- a/test/core-ajax-multivalue.html +++ b/test/core-ajax-multivalue.html @@ -34,8 +34,8 @@ test('Array valued parameters should be properly encoded', function(done) { var req = requests[0]; - assert.match(req.url, /[?&]keywords=browser/); assert.match(req.url, /[?&]keywords=chrome/); + assert.match(req.url, /[?&]keywords=browser/); }); From f0e631d876677a10b6d3eb766682686de7996e26 Mon Sep 17 00:00:00 2001 From: garlicnation Date: Thu, 6 Nov 2014 09:56:40 -0800 Subject: [PATCH 5/5] stop overwriting XHR's constructor before the html imports polyfill runs. --- test/core-ajax-multivalue.html | 43 ++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/test/core-ajax-multivalue.html b/test/core-ajax-multivalue.html index e555676..c56e88b 100644 --- a/test/core-ajax-multivalue.html +++ b/test/core-ajax-multivalue.html @@ -10,33 +10,50 @@ core-ajax - - - +