Skip to content

Cannot capture default port in a named group #234

Open
@rotu

Description

@rotu

What is the issue with the URL Pattern Standard?

Using a :<name> token to capture the port of a URL fails if the URL is using the default port for that protocol (either explicitly or implicitly). Tested in Chrome.

// false!?!?
new URLPattern('http://example.com::port').test('http://example.com:80')

// works if you use a non-standard port
new URLPattern('http://example.com::port').test('http://example.com:81') 
// works if you use an asterisk instead of a name token
new URLPattern('http://example.com:*').test('http://example.com:80')

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