Skip to content

Is colon required when specifying the protocol #221

@humphreyn

Description

@humphreyn

In version 1.5.3 you could build a url without specifying the colin in the protocol as follows:

`
const URL = require("url-parse");

  const myURL = new URL("");

  myURL.set("protocol", "https", true);

  myURL.set("slashes", true, true);

  myURL.set("hostname", "myhostname", true);

  myURL.set("port", 443, true);

  myURL.set("pathname", "my/path", true);

  console.log(myURL.toString());
 // https://myhostname:443/my/path

`
This would print the url as: "https://myhostname:443/my/path"

if you do the same with v1.5.4 it does not print out the slashes, instead you get "https:myhostname:443/my/path".

Is this expected behaviour? Or do you now always have to specify the colon with the protocol?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions