Skip to content

Whatwg protocol setter only seems to support special schemes #13523

Closed
@sebakerckhof

Description

@sebakerckhof

Currently the new whatwg url class doesn't seem to work with any other scheme except so called 'special schemes' in the spec:
https://url.spec.whatwg.org/

E.g. this works:

const { URL } = require('url');
const url = new URL('http://foo.bar');
url.protocol = 'ftp';
url.toString(); // => ftp://foo.bar

But this doesn't work:

const { URL } = require('url');
const url = new URL('http://foo.bar');
url.protocol = 's3';
url.toString(); // http://foo.bar => should be s3://foo.bar

Even schemes defined here: https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml don't work.

Not that this does work:

const { URL } = require('url');
const url = new URL('s3://foo.bar');
url.protocol; // = s3:

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.whatwg-urlIssues and PRs related to the WHATWG URL implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions