Skip to content

querystring result not consistent with encodeURIComponent #5309

Closed
@jacobp100

Description

@jacobp100

QueryString has a comment that states the following,

   // replaces encodeURIComponent
   // http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3.4

However, the spec states that you should use ToString. In the code, you’re using ValueOf. I.e.

const x = { valueOf: function() { return 'other result'; }, toString: function() { return 'spec result'; } }
encodeURIComponent(x) !== require('querystring').escape(x)

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions