Skip to content

url.resolve() behaves differently depending on the protocol of the base url #8921

Closed
@rolinh

Description

@rolinh
  • Version: v4.5.0, v6.7.0
  • Platform: Linux 3.16.0-76-generic x86_64, Linux 4.7.6-1-ARCH x86_64, FreeBSD 10.1-RELEASE-p26 amd64
  • Subsystem: url

The url.resolve() function behaves differently depending on the protocol given in the from parameter.
See this example:

> var url = require("url");
undefined
> 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'

When reading this function's documentation, this is not a behavior that I could foresee. I would have expected 'wss://foo.tld/bar' and 'ftps://foo.tld/bar' as results of the last two calls respectively.

Metadata

Metadata

Assignees

Labels

docIssues and PRs related to the documentations.urlIssues and PRs related to the legacy built-in url module.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions