Skip to content

Feature request: Replace legacy dependency for querystring parsing with URLSearchParams #25

@spurreiter

Description

@spurreiter

IMHO there is no need to relay on the legacy querystring.parse method any longer, which is used in https://github.com/BackendStack21/0http/blob/master/lib/utils/queryparams.js .

Is there a chance to replace it with the native URLSearchParams?
Maybe this gives an additional performance boost?

E.g.

module.exports = (req, url) => {
  const [path, search] = url.split('?')
  const searchParams = new URLSearchParams(search.replace(/\[\]=/g, '='))
  req.path = path
  req.query = Object.fromEntries(searchParams)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions