-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix URL issue #1652
Fix URL issue #1652
Conversation
WalkthroughThe pull request introduces a modification to the Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (12)
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 2
🧹 Nitpick comments (1)
packages/network/src/http/SimpleHttpClient.ts (1)
85-88
: Consider using URL API for path normalizationInstead of manual string manipulation, consider using the URL API for more robust path handling:
- // Remove leading slash from path - if (path.startsWith('/')) { - path = path.slice(1); - } - const url = new URL(path, this.baseURL); + const baseUrl = new URL(this.baseURL); + const url = new URL(path, baseUrl.href);This approach:
- Handles path normalization consistently
- Works with various URL formats
- Is more maintainable
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/network/src/http/SimpleHttpClient.ts
(1 hunks)packages/network/tests/http/SimpleHttpClient.testnet.test.ts
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (11)
- GitHub Check: rpc-proxy / test / test
- GitHub Check: rpc-proxy / docker / docker
- GitHub Check: unit-integration-test-browser / Build & Lint (latest)
- GitHub Check: unit-integration-test-browser / Build & Lint (lts/*)
- GitHub Check: unit-integration-test-browser / Build & Lint (18)
- GitHub Check: unit-integration-test / Build & Lint (latest)
- GitHub Check: unit-integration-test / Build & Lint (lts/*)
- GitHub Check: unit-integration-test / Build & Lint (18)
- GitHub Check: test-apps / Install and test example apps
- GitHub Check: install-build / Build & Lint
- GitHub Check: Execute doc examples
🔇 Additional comments (1)
packages/network/src/http/SimpleHttpClient.ts (1)
85-88
: Verify the impact on existing integrationsThe path normalization change might affect existing integrations that rely on the current behavior.
Run this script to find potential impacts:
✅ Verification successful
Path normalization change is safe to implement
The verification shows that only test files use paths with leading slashes, and no production code will be affected by this change. The test files can be updated alongside the implementation.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for direct http method calls with paths rg "http\s*\(\s*HttpMethod\.[A-Z]+\s*,\s*['\"]/" --type typescript # Search for get/post method calls with paths rg "\.(get|post)\s*\(\s*['\"]/" --type typescriptLength of output: 194
Script:
#!/bin/bash # Search for HTTP method calls with leading slashes in paths rg -t ts -t js -i "\.?(get|post|put|delete|patch|head|options)\s*\(\s*['\"]/" -C 2 # Search for direct http/fetch calls with leading slashes rg -t ts -t js "(http|fetch)\s*\(\s*['\"]/" -C 2 # Search specifically in the network package cd packages/network && rg -t ts -t js "\.?(get|post|put|delete|patch|head|options)\s*\(\s*['\"]/" -C 2Length of output: 3701
Script:
#!/bin/bash # List all HTTP-related files to ensure complete coverage fd -t f -e ts -e js "http|Http" --ignore-case # Double-check for any URL path strings in the codebase rg -t ts -t js "url.*['\"]/" -C 2Length of output: 532
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!
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.
Change the line 69 as @param {string} path - The URL path for the request. Leading slashes will be automatically removed.
in packages/network/src/http/SimpleHttpClient.ts .
Summary by CodeRabbit
New Features
Tests