diff --git a/lib/stringify.js b/lib/stringify.js index b8cee4bc..14122d97 100644 --- a/lib/stringify.js +++ b/lib/stringify.js @@ -102,6 +102,14 @@ var stringify = function stringify( if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) { if (encoder) { var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format); + if(generateArrayPrefix === 'comma' && encodeValuesOnly){ + const valuesArray = String(obj).split(','); + let valuesJoined = ""; + for (var i = 0; i < valuesArray.length; ++i) { + valuesJoined = valuesJoined.concat(((i===0)?'':',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format))); + } + return [formatter(keyValue) + '=' + valuesJoined]; + } return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))]; } return [formatter(prefix) + '=' + formatter(String(obj))];