2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-27 14:47:43 +03:00

fix array params

This commit is contained in:
Maximilian Hoffmann
2015-05-27 13:32:34 +02:00
parent 1629a026da
commit 594df987f2
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -29,6 +29,11 @@ module.exports = function buildUrl(url, params) {
if (val === null || typeof val === 'undefined') {
return;
}
if (utils.isArray(val)) {
key = key+'[]';
}
if (!utils.isArray(val)) {
val = [val];
}
+1 -1
View File
@@ -30,7 +30,7 @@ describe('helpers::buildUrl', function () {
it('should support array params', function () {
expect(buildUrl('/foo', {
foo: ['bar', 'baz']
})).toEqual('/foo?foo=bar&foo=baz');
})).toEqual('/foo?foo%5B%5D=bar&foo%5B%5D=baz');
});
it('should support special char params', function () {