Skip to content

Port is not validated the same when constructing URI as when using uri.port() method #344

Closed
@fredrikekelund

Description

@fredrikekelund
// The following works (when I think it shouldn't)
var uri = URI('http://example.com:robots.txt');

// Even this works
console.log(uri.port()); // Will output 'robots.txt'

// This does not work however...
var uri = URI('http://example.com');

// ...since this will (correctly) throw an error
uri.port('robots.txt');

Could we look into adding the same validation of the URI port when constructing URI instances from strings as we have when calling the uri.port method?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions