Code Monkey home page Code Monkey logo

Comments (4)

eugef avatar eugef commented on August 16, 2024 1

Hi @alxndrsn thanks for reporting this issue.

Indeed, Express.js by default uses qs instead of querystring.
I agree that for better compatibility node-mocks-http should also use qs.

Since this project relies a lot on contributors, we'd really appreciate it if you could come up with a fix. Thanks a bunch!

from node-mocks-http.

alxndrsn avatar alxndrsn commented on August 16, 2024

I agree that for better compatibility node-mocks-http should also use qs.

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:

library parser docs
expressjs ("extended"/default) qs https://expressjs.com/en/api.html#app.set
expressjs ("simple") querystring https://expressjs.com/en/api.html#app.set
NextJS URLSearchParams https://nextjs.org/docs/app/api-reference/functions/use-search-params
Koa (default) querystring https://github.com/koajs/koa/blob/master/lib/request.js#L13

Safe approaches might be to:

  1. deprecate query string parsing in this library and log a warning
  2. remove query string parsing from this library
  3. require explicit configuration of a particular parser
  4. allow some way to derive which parser to use from a user-supplied application instance

Option 2 would seem the simplest & safest, with obvious inconvenience for anyone using this feature.

from node-mocks-http.

github-actions avatar github-actions commented on August 16, 2024

Stale issue message

from node-mocks-http.

eugef avatar eugef commented on August 16, 2024

To keep library backwards compatible we will continue using built-in querystring but add a configuration option to allow using other parsing libs

from node-mocks-http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.