refactor(cli): using built-in fetch instead of axios #1730
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.
What is the current behavior?
Currently, MQTTX CLI uses Axios for HTTP requests. This introduces an additional dependency that is not heavily utilized within the project.
Issue Number
N/A (or reference the relevant issue if one exists)
What is the new behavior?
This PR replaces Axios with the built-in Fetch API for HTTP requests in MQTTX CLI. This change aims to:
Does this PR introduce a breaking change?
Specific Instructions
Node.js 18 supports the built-in fetch API.
Important note regarding TypeScript configuration:
Using
fetch
here with addingDOM
lib intsconfig.json
is not correct. See: DefinitelyTyped/DefinitelyTyped#60924. Update to Node.js 20 to resolve fetch global type issue.To properly implement this change, we need to ensure that the project is using Node.js version 20 or later, which includes proper type definitions for the global
fetch
API without relying on the DOM lib.Other information