Skip to content

req.query will produce object instead of array when it contains more than 20 values in v4.22.X #7147

@nabilzhafri

Description

@nabilzhafri

Environment information

Version: 4.22.1 / 4.22.X

Platform: MacOS / Linux

Node.js version: 24.14.1

Any other relevant information:

What steps will reproduce the bug?

Consider following API query:

GET /reports/download?tenancyIds=35&tenancyIds=28&tenancyIds=149&tenancyIds=157&tenancyIds=158&tenancyIds=159&tenancyIds=161&tenancyIds=160&tenancyIds=162&tenancyIds=163&tenancyIds=164&tenancyIds=165&tenancyIds=166&tenancyIds=167&tenancyIds=7&tenancyIds=196&tenancyIds=195&tenancyIds=198&tenancyIds=70&tenancyIds=6

Prior to version 4.22.X, when calling with query regardless of numbers, req.query.tenancyIds will always produce as array:

[
  '35',  '28',  '149', '157',
  '158', '159', '161', '160',
  '162', '163', '164', '165',
  '166', '167', '7',   '196',
   '195', '198', '70',  '6'
] 

However, in version 4.22.X, when calling with query more than 20, req.query.tenancyIds will produce as object instead (but produce as array if it's 20 or less)

// 20 or less
[
  '35',  '28',  '149', '157',
  '158', '159', '161', '160',
  '162', '163', '164', '165',
  '166', '167', '7',   '196',
   '195', '198', '70',  '6'
] 

// more than 20
{
  '0': '35',
  '1': '28',
  '2': '149',
  '3': '157',
  '4': '158',
  '5': '159',
  '6': '161',
  '7': '160',
  '8': '162',
  '9': '163',
  '10': '164',
  '11': '165',
  '12': '166',
  '13': '167',
  '14': '7',
  '15': '196',
  '16': '195',
  '17': '198',
  '18': '70',
  '19': '6',
  '20': '75'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions