Skip to content

TypeError [ERR_INVALID_URL]: Invalid URL  #3

@StarpTech

Description

@StarpTech

Hi, I started the server and tried to make a simple GET call through the browser. It errors with:

 straightforward onUncaughtException:   TypeError [ERR_INVALID_URL]: Invalid URL 

Relevant place:

const urlParts = new URL(req.url)

It's not possible to parse the URL like this. We need to do:

new URL(request.url, `http://${request.headers.host}`);

https://nodejs.org/api/http.html#messageurl

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions