Closed
Description
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: