Skip to content

Better way to get the path for a URL #1234

@TartanLlama

Description

@TartanLlama

Report:

I am curious if there is a better way to do this:

const path = new URL(event.request.url).pathname;

I tried to look for other properties on event.request, but couldn’t find one for the pathname, and also event.request.url looks to be a string vs. a URL object.
FWIW both rust and golang offer methods for it req.get_path() and Request.URL.Path so I wonder if js should as well

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