URL normalization in URL constructor

We are seeing a strange behavior in Workers regarding the URL normalization.

Even if the feature is turned off for the whole site, the new URL constructor still seems to perform the normalization:

The new URL('https://example.com/test//test2').pathname unexpectedly results in “/test/test2” instead of “/test//test2”

Is there any way to turn the normalization fully off and force the URL constructor to behave the standard way?

This has been a long time headache, unfortunately. Still no way to opt into correct behavior. You can polyfill with whatwg-url or just work around it.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.