Skip to content

URLPattern doesn't match if URL ends with / #12259

@ebebbington

Description

@ebebbington

See the below example:

const url = "http://localhost/coffee/2/"
const path = "/coffee/:id"
const pattern = new URLPattern({ path })
pattern.exec(url) // null

I believe it should match in this case, and could be a huge downfall for the usabillity of this 'new' API

Though in some cases, i think it does match when the url ends with /, so i think it might be quite flaky?

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