From da4ef441fdb4f96b5872fb6d246f08d3e3ee1e16 Mon Sep 17 00:00:00 2001 From: Shlomo Dalezman Date: Mon, 2 Feb 2015 13:38:12 -0500 Subject: [PATCH] added multi argument brackets --- mithril.js | 2 +- tests/mithril-tests.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mithril.js b/mithril.js index 59ffc113..29082ca9 100644 --- a/mithril.js +++ b/mithril.js @@ -693,7 +693,7 @@ var m = (function app(window, undefined) { var pair = value != null && (valueType === OBJECT) ? buildQueryString(value, key) : valueType === ARRAY ? - value.map(function(item) {return encodeURIComponent(key) + "=" + encodeURIComponent(item)}).join("&") : + value.map(function(item) {return encodeURIComponent(key + "[]") + "=" + encodeURIComponent(item)}).join("&") : encodeURIComponent(key) + "=" + encodeURIComponent(value) str.push(pair) } diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index 2b3ce839..ca7b21de 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -1799,7 +1799,7 @@ function testMithril(mock) { test(function() { var prop = m.request({method: "GET", url: "test", data: {foo: [1, 2]}}) mock.XMLHttpRequest.$instances.pop().onreadystatechange() - return prop().url === "test?foo=1&foo=2" + return prop().url === "test?foo%5B%5D=1&foo%5B%5D=2" }) // m.request over jsonp