Axios Instead of Node.js Built-in Fetch for HTTP Requests
darkknight13 opened this issue · comments
The cql-test-runner currently relies on the built-in Fetch API for managing HTTP requests. While Fetch is a competent tool, it's worth exploring the potential benefits of transitioning to Axios for several reasons.
-
Ease of Use and Syntax: Axios boasts a simpler and more intuitive syntax in comparison to Fetch. With Axios, handling HTTP requests and managing responses can be accomplished with fewer lines of code and reduced boilerplate.
-
Automatic JSON Parsing: Axios automatically parses JSON responses, eliminating the need for manual parsing methods like
.json()
required by Fetch. -
Error Handling: Axios streamlines error handling by providing built-in support for managing common HTTP errors. This results in a more straightforward and robust error-handling process compared to Fetch. Axios, by default, throws errors for non-200 status codes.
-
Progress Tracking: Axios offers built-in functionality for tracking upload and download progress. This feature can be particularly useful for monitoring file uploads or downloads within the application.