Skip to content

Conversation

@bjohansebas
Copy link
Member

Summary

An important change, IPv6 hostnames now return with square brackets ([]) (for new URL()), so they need to be formatted for ipaddr to correctly validate whether it’s an IPv6 URL. Additionally, the hostname also needs to be formatted in the IPv6 case, because right now, when an IPv6 hostname is passed in host, users are not including the square brackets. We could change this behavior, what do you think?

Also, it seems this will make retrieving the hostname faster.

imagen **What kind of change does this PR introduce?**

Did you add tests for your changes?

Does this PR introduce a breaking change?

If relevant, what needs to be documented once your changes are merged or what have you already documented?

@bjohansebas bjohansebas marked this pull request as draft January 26, 2026 16:33
Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with this change, feel free to merge when CI will be green, also we have url.parse in our webpack-dev-middleware, make sense to improve this there too for the next major release

@bjohansebas
Copy link
Member Author

note for myself: always remember to add a base in case the URL doesn’t come complete

imagen

@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.68%. Comparing base (18704b6) to head (0dfbd6c).
⚠️ Report is 1 commits behind head on next.

Files with missing lines Patch % Lines
lib/Server.js 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5637      +/-   ##
==========================================
+ Coverage   83.56%   83.68%   +0.11%     
==========================================
  Files          11       11              
  Lines        1947     1955       +8     
  Branches      723      724       +1     
==========================================
+ Hits         1627     1636       +9     
+ Misses        287      286       -1     
  Partials       33       33              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bjohansebas bjohansebas marked this pull request as ready for review January 30, 2026 21:54
// If the header does not have a scheme, prepend // so URL can parse it
const parseUrl = new URL(
/^(.+:)?\/\//.test(header) ? header : `//${header}`,
"http://localhost/",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only for a fallback.

@alexander-akait alexander-akait merged commit ebd7f64 into next Feb 1, 2026
75 of 102 checks passed
@alexander-akait alexander-akait deleted the bsebas/url-parser branch February 1, 2026 15:12
@alexander-akait
Copy link
Member

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants