Skip to content

Commit f1331a0

Browse files
authored
Merge pull request #181 from Clovel/fix/query-string-arrays
[Fixes #180] Allow for root-level arrays to be querystring-ed in Modem.prototype.buildQuerystring
2 parents c95995d + 50f5686 commit f1331a0

3 files changed

Lines changed: 24 additions & 1108 deletions

File tree

lib/modem.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -529,13 +529,11 @@ Modem.prototype.followProgress = function (streama, onFinished, onProgress) {
529529
Modem.prototype.buildQuerystring = function (opts) {
530530
var clone = {};
531531

532-
// serialize map and array values as JSON strings, else querystring truncates.
533-
// 't' and 'extrahosts' can be arrays but need special treatment so that they're
534-
// passed as multiple qs parameters instead of JSON values.
535532
Object.keys(opts).map(function (key, i) {
536-
if (opts[key]
537-
&& typeof opts[key] === 'object'
538-
&& !['t', 'extrahosts'].includes(key)
533+
if (
534+
opts[key] &&
535+
typeof opts[key] === 'object' &&
536+
!Array.isArray(opts[key])
539537
) {
540538
clone[key] = JSON.stringify(opts[key]);
541539
} else {

0 commit comments

Comments
 (0)