Repository navigation
[fix] Do not modify the url.URL object passed to the constructor - #2353
Open
simonkundrik wants to merge 2 commits into
Open
simonkundrik wants to merge 2 commits into
simonkundrik wants to merge 2 commits into
Conversation
The protocol of an `http:` or `https:` URL object was changed to `ws:` or `wss:` in place, so the object the caller passed in was modified. Parse a copy of it instead, as is done for strings.
lpinca
reviewed
Nov 5, 2026
Parse URL objects with new URL(address) and use the lookup option in the test.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
new WebSocket(url)changesurl.protocolfromhttp:tows:(and fromhttps:towss:) on theurl.URLobject it is given, so code that keeps using the URL afterwards sees a different one:This parses a copy of the URL object instead, as is already done for strings. I added a test, which fails on master.
npm testpasses and eslint and prettier are clean.