Open kuy opened 4 years ago
Found the problem, this is a server-side problem, where the the string will be split into many substrings at any comma. https://github.com/vasanthv/jsonbox/blob/241f981183e8a425ee445005e3e063cc7438e885/src/helper.js#L50
@vasanthv
By adding this reduce
function between the split
and the forEach
will solve the problem
req_q
.split(',')
.reduce((v, x) => {
x.includes(':') ? v.push(x) : v[v.length-1] += (',' + x)
return v
}, [])
.forEach(i => (q[i.split(':')[0]] = i.split(':')[1]));
Or changing the code a little bit with regex (I don't know much about regex, so this may contains bugs, idk)
req_q
.split(/,?(\w+):/)
.slice(1)
.reduce((v, x, i) => {
i % 2 == 0 ? v.push([x]) : v[v.length-1].push(x)
return v
}, [])
.forEach(([key, value]) => { ... })
Is there a way to find records contains a comma in string field?
Steps to reproduce.
Both GET operations return
Cannot read property 'startsWith' of undefined
error message.