Recommended JS HTTP client: Axios, Request, Superagent, ajax, fetch

The http client is an indispensable tool for requesting data in web development.

Compared

function points Axios Superagent Request Fetch Supertest Ajax
Introduction Based on xhr Improved Ajax Simplified HTTP request client The http client that comes with the browser is designed to replace XMLHttpRequest, flexible and easy to use Provide a simple HTTP test interface, simple http assertion Asynchronous JS and XML technology-a set of browser-side development technology that combines multiple technologies. The browser-side implementation is: XMLHttpRequest and ActiveXObject (lower version IE)
Promise Y Y - Y - -
Browser Y (IE8 +) Y - Y - Y
Node Y Y Y - Y -
React Native - - - Y - -
Configurable Y Y Y Y - Y
Cancelable Y - - - - -
Response timeout Y - - - - -
Prevent cross-site request forgery (XSRF) attacks Y - - - - -
Intercept unexecuted requests or responses Y - - - - -
Upload/download progress Y Y - - - -
Support block transfer coding - Y - - - -
Disadvantage The configuration is slightly more complicated Its API does not meet any standards - There are no built-in default values, such as request mode, request headers, request credentials -

Guess you like

Origin blog.csdn.net/u010682774/article/details/112330779