2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-11 18:02:32 +03:00

Merge pull request #49 from maxhoffmann/master

Fixing arrays in get params
This commit is contained in:
Matt Zabriskie
2015-07-23 09:08:16 -07:00
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -8,7 +8,9 @@ function encode(val) {
replace(/%3A/gi, ':').
replace(/%24/g, '$').
replace(/%2C/gi, ',').
replace(/%20/g, '+');
replace(/%20/g, '+').
replace(/%5B/gi, '[').
replace(/%5D/gi, ']');
}
/**
@@ -29,6 +31,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];
}