-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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: parsed .search should always be a string. #9600
Comments
I guess the same would go for |
Yes. |
Does anyone mind if I take on this issue? |
@jessicaquynh this may be a good issue to dig into but @jasnell should be able to confirm if this is something that will be an easy fix, or something we rely on the WhatWG implementation for |
Sounds good to me! Thanks @thealphanerd ! |
@jessicaquynh If you want, this can be broken up into two contributions: First, write tests for these and put them in Then you can contribute a fix that would also move those tests out of Doing it in two parts like that is not required, but it's an option. |
@Trott Thanks! I'm interested in keeping with due diligence to the process. So I will break it up into two! |
This creates a test for a known issue for url.parse(). Should there be empty keys set for search, query, hash, port, or auth, url.parse() willl return a nulltype instead of an empty string. Refs: nodejs#9600
I don't think we should change url, existing behaviour is justifiable, and @jasnell is working on a |
The existing behavior seems like a 🐛 to me. |
I agree with @sam-github:
Interpreting
The new API provides the desired behavior and changes to the old API will most probably do more harm than good at this point. |
Since there are unlikely to be changes like this on the old |
Node v7.1.0.
I parsed a url with the
require('url')
module using.parse
and ran into a gotcha.I had
path.join('vendor', url.pathname, url.search)
and it errored because.search
wasnull
.I had assumed it followed the browser behavior of returning an empty string when no search query is found.
The text was updated successfully, but these errors were encountered: