Skip to content

'querystring.parse' works a inconsistent way with URLSearchParams(chrome) and python's urlparse.parse_qs #10454

Closed
@AbnerZheng

Description

@AbnerZheng
  • Version: 7.3.0
  • Platform:Mac
  • Subsystem: 10.12.1

when parse a paramsString like "&&q=test&topic=api", where '&&' appear together, Node will get the result like this:

querystring.parse("&&q=test&topic=api") //=>{ '': [ '', '' ], q: 'test', topic: 'api' }

But in other environment, such as Chrome console, we will get the result below:

var paramsString = "&&q=test&topic=api"
var searchParams = new URLSearchParams(paramsString);
for(let p of searchParams){ console.log(p);} //=>["q", "test"],["topic", "api"]

The same as python.

Metadata

Metadata

Assignees

No one assigned

    Labels

    querystringIssues and PRs related to the built-in querystring module.urlIssues and PRs related to the legacy built-in url module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions