-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query string parsing is potentially misleading #299
Comments
Hi @alxndrsn thanks for reporting this issue. Indeed, Express.js by default uses Since this project relies a lot on contributors, we'd really appreciate it if you could come up with a fix. Thanks a bunch! |
That's not what I'm suggesting - I think doing any parsing of query strings is going to give misleading results for some users in some situations. Here are the parsers used by the frameworks listed in https://github.com/eugef/node-mocks-http/blob/master/README.md:
Safe approaches might be to:
Option 2 would seem the simplest & safest, with obvious inconvenience for anyone using this feature. |
Stale issue message |
To keep library backwards compatible we will continue using built-in |
Stale issue message |
From the README:
Query string parsing was added in #30, but the results are potentially misleading.
node-mocks-http
uses node's built-inquerystring
to parse query strings atnode-mocks-http/lib/mockRequest.js
Line 89 in dd1fb05
ExpressJS's default query string parsing (
'extended'
mode) does not usequerystring
. Seequery parser
at https://expressjs.com/en/api.html#app.set:This may lead to misleading results for tests written for an ExpressJS application with default
query parser
configuration which usenode-mocks-http
's implicit query string parsing (as opposed to thequery
option increateRequest()
).Example
Test code
Output
The text was updated successfully, but these errors were encountered: