[fix] Setter of `request.query` does not save array when length of the array is 1
Describe the bug
Node.js version: 16.10.0
OS version: Mac OS Monterey 12.3.1 (It doesn't matter...)
Description:
Actual behavior
Setter of request.query saves single element instead of the array.
Setter of request.query uses qs.stringify to save the input to request.querystring, and it would be converted into the form like key=value1&key=value2.
But when array size is 1, it becomes unable to know whether it's array or string since it would be saved as key=value1.
So preprocessing would be necessary I think.
Expected behavior
An array should be saved as I passed.
Code to reproduce
ctx.query = { tagIdList: ['abcd'] };
console.log(ctx.query); // It prints out { tagIdList: 'abcd' }
A solution was proposed in PR https://github.com/koajs/koa/pull/1673
However, I'm tentatively holding any approvals as I judge this to require a semver major bump, in which case Koa could benefit from other changes as well.