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: make path in resolveObject the same as parse #11395

Closed
wants to merge 2 commits into from

Conversation

watilde
Copy link
Member

@watilde watilde commented Feb 15, 2017

url.resolveObject should not add / automatically to have a compatibility with url.parse if provided value doesn't have any path.

I've also added a test for it. It increases the coverage of url.js,

and it will cover these lines:

  • node/lib/url.js

    Lines 830 to 842 in e4e7cd5

    if (!srcPath.length) {
    // no path at all. easy.
    // we've already handled the other stuff above.
    result.pathname = null;
    //to support http.request
    if (result.search) {
    result.path = '/' + result.search;
    } else {
    result.path = null;
    }
    result.href = result.format();
    return result;
    }
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

url, test

@nodejs-github-bot nodejs-github-bot added the url Issues and PRs related to the legacy built-in url module. label Feb 15, 2017
@hiroppy hiroppy added the test Issues and PRs related to the tests. label Feb 15, 2017
@jasnell
Copy link
Member

jasnell commented Feb 15, 2017

/cc @mscdex

@mscdex mscdex added semver-major PRs that contain breaking changes and should be released in the next major version. and removed test Issues and PRs related to the tests. labels Feb 15, 2017
@mscdex
Copy link
Contributor

mscdex commented Feb 15, 2017

Added semver-major because of the change in output. I don't have an opinion way or the other on the actual change.

@jasnell
Copy link
Member

jasnell commented Mar 22, 2017

@watilde ... can you rebase this?

watilde added 2 commits March 22, 2017 11:46
url.resolveObject should not add `/` automatically to have a
compatibility with url.parse if provided value doesn't have any path.
@watilde
Copy link
Member Author

watilde commented Mar 22, 2017

@jasnell done!

@jasnell
Copy link
Member

jasnell commented Mar 22, 2017

@watilde watilde changed the title test, url: test resolveObject with an empty path url: make path in resolveObject the same as parse Mar 22, 2017
@watilde
Copy link
Member Author

watilde commented Mar 29, 2017

Does anyone have an opinion on this change? @nodejs/collaborators

@Trott
Copy link
Member

Trott commented Mar 31, 2017

Maybe @TimothyGu or @joyeecheung might have an opinion?

@benjamingr
Copy link
Member

I'm not convinced the added value justifies breaking apps in the wild. In the very list I'd like to see a citgm run here.

@jasnell
Copy link
Member

jasnell commented Apr 1, 2017

ping @mscdex

@joyeecheung
Copy link
Member

joyeecheung commented Apr 1, 2017

+1 on a CITGM run...so:

https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/680/
EDIT: oops, I filled in a wrong refspec...here is the correct one: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/681/

(The citgm-smoker is all-red now so I am not sure if we need to launch another one against master for comparison?)

@addaleax
Copy link
Member

addaleax commented Apr 1, 2017

(The citgm-smoker is all-red now so I am not sure if we need to launch another one against master for comparison?)

None of the failures in the CITGM run should be related to this PR, they also show up in the other runs.

@watilde
Copy link
Member Author

watilde commented Apr 28, 2017

@watilde
Copy link
Member Author

watilde commented Apr 30, 2017

We still have a chance to put this into v8.x. The original behaviour could be an unexpectable action and the only way to use it is passing non-path values like this: ['#hash', '?query', '?query#hash'].

@watilde
Copy link
Member Author

watilde commented May 12, 2017

Now I think this is a very small thing, and we can look back at here when it's needed. I'm going to close this.

Thanks for your all comments anyway :)

@watilde watilde closed this May 12, 2017
@watilde watilde deleted the test-url-no-path branch May 12, 2017 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-major PRs that contain breaking changes and should be released in the next major version. url Issues and PRs related to the legacy built-in url module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants