-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.
Description
- Version: v7.5.0
- Platform: Fedora release 23 (Twenty Three) Linux 4.8.13-100.fc23.x86_64
- Subsystem: url
Latest major release v7.x changes the default value for slashes
in url.format() when given objet has a hostname but no protocol. Previously slashes: true
wasn't needed in that case, but now it is.
Example:
$ node --version
v6.9.5
$ node
> url = require('url')
> url.format({ hostname: 'foo.example', pathname: '/bar' })
'//foo.example/bar'
$ node --version
v7.5.0
$ node
> url = require('url')
> url.format({ hostname: 'foo.example', pathname: '/bar' })
'foo.example/bar'
> url.format({ hostname: 'foo.example', pathname: '/bar', slashes: true })
'//foo.example/bar'
Generating scheme-relative URLs is useful for a website that support both http
and https
; this is a common use case IMHO.
I found no mentions of this in the changelog. I believe it's a side effect of commit 336b027 regarding file:
URLs (removal of !protocol
condition).
Is this a bug or just a changelog oversight? API documentation seems to be in line with this new behavior (since v6.x), is this an undocumented bugfix then?
muymoo and MikailBag
Metadata
Metadata
Assignees
Labels
urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.