New URL() parsing is not consistent with Node or Browsers

So I’m trying to parse a URL to get another like so:

const pathname = new URL('https://myworker.workers.dev/lambda/https://www.somewhere.com').pathname;
console.log(pathname);

If you paste that into Node, Chrome, Firefox, Safari, you’ll get:

/lambda/https://www.somewhere.com

If you paste it into a worker, you’ll get:

/lambda/https:/www.somewhere.com

Yeah can confirm and made an example worker: https://testing-worker.walshydev.workers.dev/url

I have posted this in the Discord for the team to see

1 Like