Axios HTTP Client
github.com
2
Leaving SiteNav
External Link Disclaimer
You are about to visit github.com. This website is not operated by us. We are not responsible for its content or privacy practices.
About this website
Axios is a free and open-source promise-based HTTP client for JavaScript that works in both the browser and Node.js. Created by Matt Zabriskie (mzabriskie) in 2014 and maintained by the Axios community (with Jason Saayman as the current maintainer since 2020), Axios has become one of the most popular HTTP libraries, used by millions of projects. Key features: promise-based: all requests return Promises, enabling clean async/await syntax. No callback hell. Browser and Node.js: the same API works in both environments. In browsers, Axios uses XMLHttpRequest; in Node.js, it uses the http/https modules. Request methods: supports GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS. The axios.get(url, config) and axios.post(url, data, config) shorthand methods are the most commonly used. Request and response interceptors: intercept requests before they are sent (for adding auth tokens) and responses before they reach the application code (for error handling, logging, or data transformation). This is a powerful feature for centralized HTTP handling. Transformers: transform request data before sending and response data before returning. Automatic JSON transformation: Axios automatically serializes JavaScript objects to JSON for request bodies and parses JSON response bodies. Error handling: comprehensive error object with response, request, and config properties. Validation: validateStatus config to define which HTTP status codes should be treated as successful. Cancellation: Axios supports request cancellation via AbortController (since v0.22) or the deprecated CancelToken. Timeout: configurable request timeout. Progress: onUploadProgress and onDownloadProgress callbacks for progress bars. XSRF: built-in cross-site request forgery protection. axios.create: create pre-configured instances with default base URL, headers, and settings. TypeScript definitions available via @types/axios. JavaScript. MIT.
Statistics
2
Views
0
Clicks
0
Like
0
Dislike