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: added url.resolve() method's behaviour #8969

Closed
wants to merge 2 commits into from

Conversation

minervapanda
Copy link

@minervapanda minervapanda commented Oct 7, 2016

Checklist
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

url

Description of change

Solved #8921 - Updated documentation for url.resolve() by mentioning about how the method behaves differently with the change of protocol in the "from" parameter.

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. url Issues and PRs related to the legacy built-in url module. labels Oct 7, 2016
Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems pretty good so far! I’ve left a couple of suggestions, and it would be great if you could update the PR with them. If not, they can also be applied when merging the PR. :)

@@ -234,6 +234,16 @@ url.resolve('/one/two/three', 'four') // '/one/two/four'
url.resolve('http://example.com/', '/one') // 'http://example.com/one'
url.resolve('http://example.com/one', '/two') // 'http://example.com/two'
```
Note that `url.resolve()` method behaves differently depending on the protocol given in the `from` parameter. Some protocols like https, file, ftp, wss and gopher have special cases.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of suggestions:

  • Can you leave a blank line above this one?
  • Can you try to wrap the line after 80 characters?
  • I’d suggest enclosing the protocol names in backticks, i.e. https, that seems a bit more readable to me.

```js
url.resolve('https://foo.tld', 'bar'); // 'https://foo.tld/bar'
url.resolve('wss://foo.tld', 'bar') // 'wss://bar'
url.resolve('ftps://foo.tld', 'bar') // 'ftps://bar'
Copy link
Member

@addaleax addaleax Oct 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t have a strong preference for either way, but probably either all of these lines should end with a semicolon or none of them?

url.resolve('wss://foo.tld', 'bar') // 'wss://bar'
url.resolve('ftps://foo.tld', 'bar') // 'ftps://bar'
```
Although,the uniform behaviour of the method is achieved when the URL ends with a slash.
Copy link
Member

@addaleax addaleax Oct 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s a space missing after Although, (and maybe a blank line above this one, too). Also, it might be good to have an example of that behaviour listed here?

@mscdex
Copy link
Contributor

mscdex commented Oct 7, 2016

The subsystem should be doc: instead of url: in the commit message.

@minervapanda
Copy link
Author

I am going to incorporate all the changes you have suggested @addaleax ! Thanks for the feedback. @mscdex In the issue #8921 the subsystem mentioned was url.

@gibfahn
Copy link
Member

gibfahn commented Oct 7, 2016

@minervapanda I think we always use doc: for documentation changes, no matter where the original problem was.

@mscdex
Copy link
Contributor

mscdex commented Oct 7, 2016

Yep, what @gibfahn said.

@minervapanda
Copy link
Author

I will take care of this and amend the commit here. Thanks for the clarification.

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the nits @addaleax mentioned fixed. Thank you for this!

@minervapanda minervapanda force-pushed the master branch 4 times, most recently from 3c75eea to e33fdcd Compare October 7, 2016 18:13
@@ -235,6 +235,18 @@ url.resolve('http://example.com/', '/one') // 'http://example.com/one'
url.resolve('http://example.com/one', '/two') // 'http://example.com/two'
```

Note that `url.resolve()` method depends on the protocol given in the `from` parameter. Some protocols like `https`, `file`, `ftp`, `wss` and `gopher` have special cases.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, one additional minor nit: can you please line wrap at 80-chars?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sure. Eliminating this line " Note that url.resolve() method depends on the protocol given in the from parameter." Would be fine right ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That first sentence is fine, just add a line break or two in there so a single line doesn't go past 80 chars :-)

@minervapanda minervapanda force-pushed the master branch 2 times, most recently from 558bdd4 to 7fe931c Compare October 7, 2016 18:48
@Trott
Copy link
Member

Trott commented Oct 7, 2016

If I'm not mistaken, it looks like this adds four files that shouldn't be there. This should just be the changes to url.md, I think.

@Trott
Copy link
Member

Trott commented Oct 7, 2016

Tiny nit: The verb (added) in the commit message should be imperative (add). Not a big deal if you don't want to fix it, as whoever lands the PR can fix it at that time. But if you want to save them a little bit of typing, that would be great.

@minervapanda
Copy link
Author

minervapanda commented Oct 7, 2016

Yes. @Trott Everything was okay in the previous commit.While committing again , by mistake I changed 4 other files. I am fixing this now. I am puzzled , what are those other files.

@minervapanda minervapanda force-pushed the master branch 2 times, most recently from 873871b to c0e1785 Compare October 7, 2016 21:22
@addaleax
Copy link
Member

addaleax commented Oct 7, 2016

Yeah, this looks good. added vs add shouldn’t be a big deal. :)

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@addaleax
Copy link
Member

addaleax commented Oct 8, 2016

@minervapanda Any specific reason to close this? You may want to remove the last commit here but otherwise this PR was just fine.

@minervapanda
Copy link
Author

@addaleax I am unable to send a Pull Request , when I already have a pull request open. Please help. I am unable to send multiple PR for different issues. I have solved three issues , but the commit comes up in the same PR thread. can you help @addaleax

@minervapanda
Copy link
Author

image
This is what I am getting , cant reopen this PR as I already have a PR.

@lpinca
Copy link
Member

lpinca commented Oct 9, 2016

@minervapanda use a different branch for each issue/PR.

From your fork of node run this for each PR you want to submit:

git checkout master
git checkout -b issue-x

Do your changes, then commit and send a PR from that branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. 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.

8 participants