Skip to content

Parsing object with array doesn't split a value #357

@ghost

Description

Parsing a query string object with parameter that intended to be an array doesn't split value by comma, while query string in a form of string is parsed correctly.

This is an issue when integrating with frameworks like HAPI that provides query string as a dictionary.

Example

const qs = require('qs');

// Works
console.log(qs.parse('color=a,b', { comma: true }));
// Result: { color: [ 'a', 'b' ] }

// Doesn't work
console.log(qs.parse({ color: 'a,b' }, { comma: true }))
// Result: { color: 'a,b' }
// Expected result as above: { color: [ 'a', 'b' ] }

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions