Skip to content
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

url: .search property is inconsistent depending on parseQueryString #13404

Closed
tniessen opened this issue Jun 2, 2017 · 0 comments
Closed

url: .search property is inconsistent depending on parseQueryString #13404

tniessen opened this issue Jun 2, 2017 · 0 comments
Labels
url Issues and PRs related to the legacy built-in url module.

Comments

@tniessen
Copy link
Member

tniessen commented Jun 2, 2017

  • Version: master
  • Platform: Windows
  • Subsystem: url

Parsing a URL without a search part changes its behavior if parseQueryString is set:

> url.parse('http://example.com/', false).search
null
> url.parse('http://example.com/', true).search
''

We should probably change this line

this.search = '';

to this

this.search = null;

Users most likely will not expect parseQueryString to affect the value of .search.


There was a similar discussion at #9600, but @sam-github and I both think that the behavior discussed there is in fact justifiable.

Is there any justification for this behavior or do we consider this a bug? If we do, I will create a semver-major PR later. (I know that we do not plan to make any big changes to the old url API, but I would personally consider this a bug.)


cc @nodejs/url

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
url Issues and PRs related to the legacy built-in url module.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant