-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add hostname for checkAddress #525
Conversation
WalkthroughThe recent update introduces modifications to the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Run & review this pull request in StackBlitz Codeflow. commit: urllib
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #525 +/- ##
=======================================
Coverage 97.86% 97.86%
=======================================
Files 10 10
Lines 1596 1596
Branches 256 256
=======================================
Hits 1562 1562
Misses 30 30
Partials 4 4 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/HttpAgent.ts (3 hunks)
- test/HttpClient.test.ts (1 hunks)
Additional comments not posted (3)
src/HttpAgent.ts (2)
9-9
: Type definition update approved.The
CheckAddressFunction
type definition now includes thehostname
parameter, which is correctly added.
82-82
: Function call update approved.The
#checkAddress
function is now called with thehostname
parameter, which is correctly passed.test/HttpClient.test.ts (1)
336-351
: New test case approved.The new test case correctly validates the hostname checking functionality within the
HttpClient
class.
if (!options.checkAddress(address, family, hostname)) { | ||
err = new IllegalAddressError(hostname, address, family); | ||
} | ||
} else if (Array.isArray(address)) { | ||
const addresses = address as { address: string, family: number }[]; | ||
for (const addr of addresses) { | ||
if (!options.checkAddress(addr.address, addr.family)) { | ||
if (!options.checkAddress(addr.address, addr.family, hostname)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
Function call update required.
Some instances of the checkAddress
function do not match the new signature with the hostname
parameter. Please update the following locations:
test/HttpClient.test.ts
: lines wherecheckAddress
is called without thehostname
parameter.src/HttpClient.ts
: lines wherecheckAddress
is called without thehostname
parameter.
Analysis chain
Function call update approved.
The checkAddress
function is now called with the hostname
parameter, which is correctly passed in both instances.
However, ensure that all function calls to checkAddress
match the new signature.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify all function calls to `checkAddress` match the new signature.
# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type-add 'ts' --type-add 'tsx' --type ts,tsx 'checkAddress'
Length of output: 120
Script:
#!/bin/bash
# Description: Verify all function calls to `checkAddress` match the new signature.
# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type-add 'ts:*.ts' --type-add 'tsx:*.tsx' --type ts,tsx 'checkAddress'
Length of output: 106
Script:
#!/bin/bash
# Description: Verify all function calls to `checkAddress` match the new signature.
# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type-add 'ts:*.ts' --type-add 'tsx:*.tsx' --type ts --type tsx 'checkAddress'
Length of output: 1249
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/HttpAgent.ts (3 hunks)
- test/HttpClient.test.ts (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- src/HttpAgent.ts
- test/HttpClient.test.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/HttpAgent.ts (3 hunks)
- test/HttpClient.test.ts (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- src/HttpAgent.ts
- test/HttpClient.test.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[skip ci] ## [4.2.0](v4.1.0...v4.2.0) (2024-07-08) ### Features * add hostname for checkAddress ([#525](#525)) ([88b6e56](88b6e56))
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced hostname validation in address checking for enhanced security. - **Tests** - Added a new test case to verify hostname validation logic. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced hostname validation in address checking for enhanced security. - **Tests** - Added a new test case to verify hostname validation logic. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
New Features
Tests