This change https://github.com/ljharb/qs/blob/master/CHANGELOG.md#6100 which was released on a non-breaking release has broken a lot of code that was working fine before. I looked at the PR and the way the implementation works is going to throw upon encountering any value more than once, which seems flawed. I would recommend reverting that PR and rethinking the implementation, or at the very least disabling it by default and adding a flag to enable that behavior.
Reproduction:
const hourOfDay = {
function: 'hour_of_day'
}
const p1 = {
function: 'gte',
arguments: [ hourOfDay, 0 ]
}
const p2 = {
function: 'lte',
arguments: [ hourOfDay, 23 ]
}
qs.stringify({
filters: {
$and: [ p1, p2 ]
}
})
throws
Uncaught RangeError: Cyclic object value
at stringify (/Users/contra/Projects/staeco/services/api/node_modules/qs/lib/stringify.js:78:15)
at stringify (/Users/contra/Projects/staeco/services/api/node_modules/qs/lib/stringify.js:140:29)
at stringify (/Users/contra/Projects/staeco/services/api/node_modules/qs/lib/stringify.js:140:29)
at stringify (/Users/contra/Projects/staeco/services/api/node_modules/qs/lib/stringify.js:140:29)
at stringify (/Users/contra/Projects/staeco/services/api/node_modules/qs/lib/stringify.js:140:29)
at Object.module.exports [as stringify] (/Users/contra/Projects/x/services/api/node_modules/qs/lib/stringify.js:256:27)
Related: #395 #394 #393
This change https://github.com/ljharb/qs/blob/master/CHANGELOG.md#6100 which was released on a non-breaking release has broken a lot of code that was working fine before. I looked at the PR and the way the implementation works is going to throw upon encountering any value more than once, which seems flawed. I would recommend reverting that PR and rethinking the implementation, or at the very least disabling it by default and adding a flag to enable that behavior.
Reproduction:
throws
Related: #395 #394 #393