You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following test will fail, since it totally disallow the non-string values (stated in test.js line 520)
it('return boolean as boolean', () => {
query = mqs.parse({
foo: true,
bar: false,
});
assert.deepEqual(query, {
foo: true,
bar: false,
});
});
But here is my use case, I'm using fastify and utilized their integrated ajv as my validator. My ajv was configured to do a type coercion, hence, if I pass the following query ?foo=true&bar=false the returned value from validator are boolean values.
{
foo: true,
bar: false
}
If I pass this to mqs.parse() it returns an empty object since mqs totally disallow bool values.
Turning off the coercion is not an option for me. And converting it back to string is a dirty hack. I guess it might be good if this will allow by mqs itself.
I can send a PR and test, but I want to know the importance of discarding the boolean values in test.js line 520, if there's any.
The text was updated successfully, but these errors were encountered:
edgracilla
added a commit
to edgracilla/node-mongo-querystring
that referenced
this issue
Nov 1, 2019
The following test will fail, since it totally disallow the
non-string
values (stated intest.js
line 520)But here is my use case, I'm using
fastify
and utilized their integratedajv
as my validator. Myajv
was configured to do a type coercion, hence, if I pass the following query?foo=true&bar=false
the returned value from validator are boolean values.If I pass this to
mqs.parse()
it returns an empty object sincemqs
totally disallow bool values.Turning off the coercion is not an option for me. And converting it back to string is a dirty hack. I guess it might be good if this will allow by
mqs
itself.I can send a PR and test, but I want to know the importance of discarding the boolean values in
test.js line 520
, if there's any.The text was updated successfully, but these errors were encountered: