fix: depreacted request-promise module #1017
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
request-promise
module is now deprecated as it relies on the deprecated request package. Please refer to the following link for more information: request/request#3142In light of this deprecation, we are discontinuing the use of the
request-promise
module and adopting the node-fetch module as an alternative.node-fetch
is a lightweight and widely utilized package. It is important to note that Node.js has introduced a native fetch module starting from version 18. Consequently, once support for Node.js versions 14 and 16 is discontinued, we will seamlessly transition to utilizing the fetch module fromnode-fetch
.what's pending?
Notable Changes
request-promise response body is automatically parsed based on content type. With node-fetch, we need to manually parse the response according to the usage.
request-promise automatically converts basic data types like objects and arrays to JSON-formatted strings by default, but node-fetch not.
node-fetch does not automatically serialize the body in the same way as request-promise, so according to the response header content-type, manually converted to the desired response type.
To address the certificate authorization issue with node-fetch, process.env.NODE_TLS_REJECT_UNAUTHORIZED was set to '0' in tests.
The changes are only in test files.