Replace deprecated request library with native fetch#198
Replace deprecated request library with native fetch#198
Conversation
Co-authored-by: Apollon77 <11976694+Apollon77@users.noreply.github.com>
index.js
Outdated
| const timeoutId = setTimeout(() => controller.abort(), this.timeout); | ||
|
|
||
| // Perform the request using fetch | ||
| fetch(url, { |
There was a problem hiding this comment.
@copilot You have duplicated the fetch call logic twice. Please create a method to reduce code duplication.
There was a problem hiding this comment.
Created a shared performFetchRequest function to eliminate the duplicated fetch logic. Both authenticatedPost and sendMessageHttp methods now use this common function, reducing code duplication and improving maintainability. Commit: b3c12f4
Co-authored-by: Apollon77 <11976694+Apollon77@users.noreply.github.com>
Added changelog entry under "### WORK IN PROGRESS" section in README.md, documenting the breaking Node.js 18+ requirement and the replacement of the deprecated request library with native fetch. Commit: b3c12f4 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:
If you need me to access, download, or install something from one of these locations, you can either:
|
requestlibrary usage in the codebaserequestdependency from package.jsonauthenticatedPostmethod to use native fetch with form datasendMessageHttpmethod to use native fetch with JSON dataperformFetchRequestfunctionChanges Made
requestdependencyrequestimportcreateFormData()helper function for form data handlingperformFetchRequest()shared function to eliminate code duplicationauthenticatedPost()method with fetch-based implementation using shared functionsendMessageHttp()method with fetch-based implementation using shared functionCode Quality Improvements
performFetchRequestfunctionTesting Results
The implementation maintains 100% API compatibility while using native Node.js fetch instead of the deprecated request library.
Fixes #195.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.