aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/httpSpec.js
diff options
context:
space:
mode:
authorTom Davis2012-09-14 17:42:39 -0400
committerIgor Minar2012-11-24 22:26:23 +0100
commit79af2badcb087881e3fd600f6ae5bf3f86a2daf8 (patch)
treee8a09cdb42f371e4f6c15dbb69c2faf7c82e0f38 /test/ng/httpSpec.js
parent610927d77b77700c5c61accd503a2af0fa51cfe6 (diff)
downloadangular.js-79af2badcb087881e3fd600f6ae5bf3f86a2daf8.tar.bz2
fix($http): config.param should expand array values properly
Today, calling e.g. $http(url, { params: { a: [1,2,3] } }) results in a query string like "?a=%5B1%2C2%2C3%5D" which is undesirable. This commit enhances buildURL to createa query string like "?a=1&a=2&a=3". BREAKING CHANGE: if the server relied on the buggy behavior then either the backend should be fixed or a simple serialization of the array should be done on the client before calling the $http service. Closes #1363
Diffstat (limited to 'test/ng/httpSpec.js')
-rw-r--r--test/ng/httpSpec.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ng/httpSpec.js b/test/ng/httpSpec.js
index 45d31eef..060cadc9 100644
--- a/test/ng/httpSpec.js
+++ b/test/ng/httpSpec.js
@@ -147,6 +147,12 @@ describe('$http', function() {
$httpBackend.expect('GET', '/url?a=1&b=%7B%22c%22%3A3%7D').respond('');
$http({url: '/url', params: {a:1, b:{c:3}}, method: 'GET'});
}));
+
+
+ it('should expand arrays in params map', inject(function($httpBackend, $http) {
+ $httpBackend.expect('GET', '/url?a=1&a=2&a=3').respond('');
+ $http({url: '/url', params: {a: [1,2,3]}, method: 'GET'});
+ }));
});