| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Wrap IPv6 addresses in square brackets when making URL in ensureAddress, fixing regression (coder#1582)
|
|
||
| if (typeof addr !== "string") { | ||
| return new URL(`${protocol}://${addr.address}:${addr.port}`) | ||
| const host = addr.family === "IPv6" ? `[${addr.address}]` : addr.address |
There was a problem hiding this comment.
Love how simple this is 👏🏼
Sorry, something went wrong.
| it("should construct URL with an IPv4 address", async () => { | ||
| mockServer.address = () => ({ address: "1.2.3.4", port: 5678, family: "IPv4" }) | ||
| const address = ensureAddress(mockServer, "http") | ||
| expect(address.toString()).toBe(`http://1.2.3.4:5678/`) | ||
| }) | ||
| it("should construct URL with an IPv6 address", async () => { | ||
| mockServer.address = () => ({ address: "a:b:c:d::1234", port: 5678, family: "IPv6" }) | ||
| const address = ensureAddress(mockServer, "http") | ||
| expect(address.toString()).toBe(`http://[a:b:c:d::1234]:5678/`) |
There was a problem hiding this comment.
appreciate you adding more tests as well 👏🏼
Sorry, something went wrong.
There was a problem hiding this comment.
This looks great to me! Thank you so much 👏🏼
I'll let @code-asher give the final ✅
Sorry, something went wrong.
Codecov Report
@@ Coverage Diff @@
## main #5133 +/- ##
==========================================
+ Coverage 71.73% 71.75% +0.01%
==========================================
Files 30 30
Lines 1684 1685 +1
Branches 374 375 +1
==========================================
+ Hits 1208 1209 +1
Misses 407 407
Partials 69 69
Continue to review full report at Codecov.
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Wrap IPv6 addresses in square brackets for URL in ensureAddress.
Fixes #1582 (regression)
Thanks ;-)