-
Notifications
You must be signed in to change notification settings - Fork 42
Replace dependency 'request' with built-in fetch() API #365
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
Conversation
|
@mikeharder 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: mikeharder <9459391+mikeharder@users.noreply.github.com>
| } | ||
|
|
||
| try { | ||
| return parseContent(options.url, responseBody) |
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.
No longer need to check type of responseBody, because response.text() is always string.
The
requestlibrary is deprecated and no longer maintained. This PR removes the dependency and replaces its usage with Node.js's built-infetch()API, which is available in Node.js ≥ 18.0.0 (this project requires ≥ 18.0.0).Changes Made
requestdependency frompackage.jsonand@types/requestfrom devDependenciesmakeRequest()function insrc/lib/util/utils.tsto usefetch()instead of the request libraryResponsetype that was specific to the request libraryBefore/After
Before:
After:
The function signature and behavior remain identical from the caller's perspective, ensuring backward compatibility.
Testing
Fixes #360.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
httpbin.orgnode /tmp/test-makeRequest.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.