docs: grammar issue in *.md (#7215)

* fix readme.md

* fix ECOSYSTEM.md

* fix CONTRIBUTING.md
This commit is contained in:
WuMingDao 2025-11-11 14:34:36 +08:00 committed by GitHub
parent e6d71017d3
commit 7f1fe57250
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 36 additions and 36 deletions

View File

@ -20,9 +20,9 @@ Please update the [documentation](https://axios-http.com/docs/intro) accordingly
## Developing ## Developing
- `npm run test` run the jasmine and mocha tests - `npm run test` runs the jasmine and mocha tests
- `npm run build` run rollup and bundle the source - `npm run build` runs rollup and bundles the source
- `npm run version` prepare the code for release - `npm run version` prepares the code for release
## Running Examples ## Running Examples

View File

@ -9,7 +9,7 @@ This is a list of axios related libraries and resources. If you have a suggestio
* [axios-vcr](https://github.com/nettofarah/axios-vcr) - 📼 Record and Replay Axios requests * [axios-vcr](https://github.com/nettofarah/axios-vcr) - 📼 Record and Replay Axios requests
* [@3846masa/axios-cookiejar-support](https://github.com/3846masa/axios-cookiejar-support) - Add tough-cookie support to axios * [@3846masa/axios-cookiejar-support](https://github.com/3846masa/axios-cookiejar-support) - Add tough-cookie support to axios
* [axios-method-override](https://github.com/jacobbuck/axios-method-override) - Axios http request method override plugin * [axios-method-override](https://github.com/jacobbuck/axios-method-override) - Axios http request method override plugin
* [axios-cache-plugin](https://github.com/jin5354/axios-cache-plugin) - Help you cache GET request when using axios. * [axios-cache-plugin](https://github.com/jin5354/axios-cache-plugin) - Help you cache GET requests when using axios.
* [axios-extensions](https://github.com/kuitos/axios-extensions) - A collection of axios extensions, including throttle and cache GET request plugin. * [axios-extensions](https://github.com/kuitos/axios-extensions) - A collection of axios extensions, including throttle and cache GET request plugin.
* [axios-fetch](https://github.com/lifeomic/axios-fetch) - A WebAPI Fetch implementation backed by an Axios client * [axios-fetch](https://github.com/lifeomic/axios-fetch) - A WebAPI Fetch implementation backed by an Axios client
* [axios-actions](https://github.com/davestewart/axios-actions) - Bundle endpoints as callable, reusable services * [axios-actions](https://github.com/davestewart/axios-actions) - Bundle endpoints as callable, reusable services
@ -17,7 +17,7 @@ This is a list of axios related libraries and resources. If you have a suggestio
* [axios-data-unpacker](https://github.com/anubhavsrivastava/axios-data-unpacker) - Axios interceptor that unpacks HTTP responses so that you can focus on actual server data. * [axios-data-unpacker](https://github.com/anubhavsrivastava/axios-data-unpacker) - Axios interceptor that unpacks HTTP responses so that you can focus on actual server data.
* [r2curl](https://github.com/uyu423/r2curl) - Extracts the cURL command string from the Axios object. (AxiosResponse, AxiosRequestConfig) * [r2curl](https://github.com/uyu423/r2curl) - Extracts the cURL command string from the Axios object. (AxiosResponse, AxiosRequestConfig)
* [swagger-taxos-codegen](https://github.com/michalzaq12/swagger-taxos-codegen) - Axios based Swagger Codegen (tailored for typescript) * [swagger-taxos-codegen](https://github.com/michalzaq12/swagger-taxos-codegen) - Axios based Swagger Codegen (tailored for typescript)
* [axios-endpoints](https://github.com/renancaraujo/axios-endpoints) - Axios endpoints helps you to create a more concise endpoint mapping with axios. * [axios-endpoints](https://github.com/renancaraujo/axios-endpoints) - Axios endpoints help you to create a more concise endpoint mapping with axios.
* [axios-multi-api](https://github.com/MattCCC/axios-multi-api) - Easy API handling whenever there are many endpoints to add. It helps to make Axios requests in an easy and declarative manner. * [axios-multi-api](https://github.com/MattCCC/axios-multi-api) - Easy API handling whenever there are many endpoints to add. It helps to make Axios requests in an easy and declarative manner.
* [axios-url-template](https://github.com/rafw87/axios-url-template) - Axios interceptor adding support for URL templates. * [axios-url-template](https://github.com/rafw87/axios-url-template) - Axios interceptor adding support for URL templates.
* [zodios](https://www.zodios.org) - Typesafe API client based on axios * [zodios](https://www.zodios.org) - Typesafe API client based on axios
@ -39,7 +39,7 @@ This is a list of axios related libraries and resources. If you have a suggestio
### Unit testing ### Unit testing
* [axiosist](https://github.com/Gerhut/axiosist) - Axios based supertest: convert node.js request handler to axios adapter, used for node.js server unit test. * [axiosist](https://github.com/Gerhut/axiosist) - Axios based supertest: convert node.js request handler to axios adapter, used for node.js server unit test.
* [axios-mock-adapter](https://github.com/ctimmerm/axios-mock-adapter) — Axios adapter that allows to easily mock requests * [axios-mock-adapter](https://github.com/ctimmerm/axios-mock-adapter) — Axios adapter that allows for easily mocking requests
* [axios-test-instance](https://github.com/remcohaszing/axios-test-instance) — Test NodeJS backends using Axios * [axios-test-instance](https://github.com/remcohaszing/axios-test-instance) — Test NodeJS backends using Axios
* [moxios](https://github.com/axios/moxios) - Mock axios requests for testing * [moxios](https://github.com/axios/moxios) - Mock axios requests for testing
* [mocha-axios](https://github.com/jdrydn/mocha-axios) - Streamlined integration testing with Mocha & Axios * [mocha-axios](https://github.com/jdrydn/mocha-axios) - Streamlined integration testing with Mocha & Axios

View File

@ -161,7 +161,7 @@ import axios from 'axios';
console.log(axios.isCancel('something')); console.log(axios.isCancel('something'));
```` ````
If you use `require` for importing, **only default export is available**: If you use `require` for importing, **only the default export is available**:
```js ```js
const axios = require('axios'); const axios = require('axios');
@ -367,9 +367,9 @@ These are the available config options for making requests. Only the `url` is re
// `method` is the request method to be used when making the request // `method` is the request method to be used when making the request
method: 'get', // default method: 'get', // default
// `baseURL` will be prepended to `url` unless `url` is absolute and option `allowAbsoluteUrls` is set to true. // `baseURL` will be prepended to `url` unless `url` is absolute and the option `allowAbsoluteUrls` is set to true.
// It can be convenient to set `baseURL` for an instance of axios to pass relative URLs // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
// to methods of that instance. // to the methods of that instance.
baseURL: 'https://some-domain.com/api/', baseURL: 'https://some-domain.com/api/',
// `allowAbsoluteUrls` determines whether or not absolute URLs will override a configured `baseUrl`. // `allowAbsoluteUrls` determines whether or not absolute URLs will override a configured `baseUrl`.
@ -411,7 +411,7 @@ These are the available config options for making requests. Only the `url` is re
// Custom encoder function which sends key/value pairs in an iterative fashion. // Custom encoder function which sends key/value pairs in an iterative fashion.
encode?: (param: string): string => { /* Do custom operations here and return transformed string */ }, encode?: (param: string): string => { /* Do custom operations here and return transformed string */ },
// Custom serializer function for the entire parameter. Allows user to mimic pre 1.x behaviour. // Custom serializer function for the entire parameter. Allows the user to mimic pre 1.x behaviour.
serialize?: (params: Record<string, any>, options?: ParamsSerializerOptions ), serialize?: (params: Record<string, any>, options?: ParamsSerializerOptions ),
// Configuration for formatting array indexes in the params. // Configuration for formatting array indexes in the params.
@ -419,8 +419,8 @@ These are the available config options for making requests. Only the `url` is re
}, },
// `data` is the data to be sent as the request body // `data` is the data to be sent as the request body
// Only applicable for request methods 'PUT', 'POST', 'DELETE , and 'PATCH' // Only applicable for request methods 'PUT', 'POST', 'DELETE', and 'PATCH'
// When no `transformRequest` is set, must be of one of the following types: // When no `transformRequest` is set, it must be of one of the following types:
// - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
// - Browser only: FormData, File, Blob // - Browser only: FormData, File, Blob
// - Node only: Stream, Buffer, FormData (form-data package) // - Node only: Stream, Buffer, FormData (form-data package)
@ -472,7 +472,7 @@ These are the available config options for making requests. Only the `url` is re
// 'utf8', 'UTF8', 'utf16le', 'UTF16LE' // 'utf8', 'UTF8', 'utf16le', 'UTF16LE'
responseEncoding: 'utf8', // default responseEncoding: 'utf8', // default
// `xsrfCookieName` is the name of the cookie to use as a value for xsrf token // `xsrfCookieName` is the name of the cookie to use as a value for the xsrf token
xsrfCookieName: 'XSRF-TOKEN', // default xsrfCookieName: 'XSRF-TOKEN', // default
// `xsrfHeaderName` is the name of the http header that carries the xsrf token value // `xsrfHeaderName` is the name of the http header that carries the xsrf token value
@ -551,7 +551,7 @@ These are the available config options for making requests. Only the `url` is re
// Use `false` to disable proxies, ignoring environment variables. // Use `false` to disable proxies, ignoring environment variables.
// `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
// supplies credentials. // supplies credentials.
// This will set an `Proxy-Authorization` header, overwriting any existing // This will set a `Proxy-Authorization` header, overwriting any existing
// `Proxy-Authorization` custom headers you have set using `headers`. // `Proxy-Authorization` custom headers you have set using `headers`.
// If the proxy server uses HTTPS, then you must set the protocol to `https`. // If the proxy server uses HTTPS, then you must set the protocol to `https`.
proxy: { proxy: {
@ -623,7 +623,7 @@ These are the available config options for making requests. Only the `url` is re
## Response Schema ## Response Schema
The response for a request contains the following information. The response to a request contains the following information.
```js ```js
{ {
@ -722,20 +722,20 @@ const instance = axios.create();
// Add a request interceptor // Add a request interceptor
instance.interceptors.request.use(function (config) { instance.interceptors.request.use(function (config) {
// Do something before request is sent // Do something before the request is sent
return config; return config;
}, function (error) { }, function (error) {
// Do something with request error // Do something with the request error
return Promise.reject(error); return Promise.reject(error);
}); });
// Add a response interceptor // Add a response interceptor
instance.interceptors.response.use(function (response) { instance.interceptors.response.use(function (response) {
// Any status code that lie within the range of 2xx cause this function to trigger // Any status code that lies within the range of 2xx causes this function to trigger
// Do something with response data // Do something with response data
return response; return response;
}, function (error) { }, function (error) {
// Any status codes that falls outside the range of 2xx cause this function to trigger // Any status codes that fall outside the range of 2xx cause this function to trigger
// Do something with response error // Do something with response error
return Promise.reject(error); return Promise.reject(error);
}); });
@ -767,7 +767,7 @@ instance.interceptors.request.use(function () {/*...*/});
When you add request interceptors, they are presumed to be asynchronous by default. This can cause a delay When you add request interceptors, they are presumed to be asynchronous by default. This can cause a delay
in the execution of your axios request when the main thread is blocked (a promise is created under the hood for in the execution of your axios request when the main thread is blocked (a promise is created under the hood for
the interceptor and your request gets put on the bottom of the call stack). If your request interceptors are synchronous you can add a flag the interceptor and your request gets put at the bottom of the call stack). If your request interceptors are synchronous you can add a flag
to the options object that will tell axios to run the code synchronously and avoid any delays in request execution. to the options object that will tell axios to run the code synchronously and avoid any delays in request execution.
```js ```js
@ -793,7 +793,7 @@ axios.interceptors.request.use(function (config) {
}, null, { runWhen: onGetCall }); }, null, { runWhen: onGetCall });
``` ```
> **Note:** options parameter(having `synchronous` and `runWhen` properties) is only supported for request interceptors at the moment. > **Note:** The options parameter(having `synchronous` and `runWhen` properties) is only supported for request interceptors at the moment.
### Interceptor Execution Order ### Interceptor Execution Order
@ -832,7 +832,7 @@ instance.interceptors.response.use(interceptor('Response Interceptor 3'));
### Multiple Interceptors ### Multiple Interceptors
Given you add multiple response interceptors Given that you add multiple response interceptors
and when the response was fulfilled and when the response was fulfilled
- then each interceptor is executed - then each interceptor is executed
- then they are executed in the order they were added - then they are executed in the order they were added
@ -843,11 +843,11 @@ and when the response was fulfilled
- then the following rejection-interceptor is called - then the following rejection-interceptor is called
- once caught, another following fulfill-interceptor is called again (just like in a promise chain). - once caught, another following fulfill-interceptor is called again (just like in a promise chain).
Read [the interceptor tests](./test/specs/interceptors.spec.js) for seeing all this in code. Read [the interceptor tests](./test/specs/interceptors.spec.js) to see all this in code.
## Error Types ## Error Types
There are many different axios error messages that can appear that can provide basic information about the specifics of the error and where opportunities may lie in debugging. There are many different axios error messages that can appear which can provide basic information about the specifics of the error and where opportunities may lie in debugging.
The general structure of axios errors is as follows: The general structure of axios errors is as follows:
| Property | Definition | | Property | Definition |
@ -856,7 +856,7 @@ The general structure of axios errors is as follows:
| name | This defines where the error originated from. For axios, it will always be an 'AxiosError'. | | name | This defines where the error originated from. For axios, it will always be an 'AxiosError'. |
| stack | Provides the stack trace of the error. | | stack | Provides the stack trace of the error. |
| config | An axios config object with specific instance configurations defined by the user from when the request was made | | config | An axios config object with specific instance configurations defined by the user from when the request was made |
| code | Represents an axios identified error. The table below lists out specific definitions for internal axios error. | | code | Represents an axios identified error. The table below lists specific definitions for internal axios error. |
| status | HTTP response status code. See [here](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) for common HTTP response status code meanings. | status | HTTP response status code. See [here](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) for common HTTP response status code meanings.
Below is a list of potential axios identified error: Below is a list of potential axios identified error:
@ -870,7 +870,7 @@ Below is a list of potential axios identified error:
| ERR_INVALID_URL | Invalid URL provided for axios request. | | ERR_INVALID_URL | Invalid URL provided for axios request. |
| ECONNABORTED | Typically indicates that the request has been timed out (unless `transitional.clarifyTimeoutError` is set) or aborted by the browser or its plugin. | | ECONNABORTED | Typically indicates that the request has been timed out (unless `transitional.clarifyTimeoutError` is set) or aborted by the browser or its plugin. |
| ERR_CANCELED | Feature or method is canceled explicitly by the user using an AbortSignal (or a CancelToken). | | ERR_CANCELED | Feature or method is canceled explicitly by the user using an AbortSignal (or a CancelToken). |
| ETIMEDOUT | Request timed out due to exceeding default axios timelimit. `transitional.clarifyTimeoutError` must be set to `true`, otherwise a generic `ECONNABORTED` error will be thrown instead. | | ETIMEDOUT | Request timed out due to exceeding the default axios timelimit. `transitional.clarifyTimeoutError` must be set to `true`, otherwise a generic `ECONNABORTED` error will be thrown instead. |
| ERR_NETWORK | Network-related issue. In the browser, this error can also be caused by a [CORS](https://developer.mozilla.org/ru/docs/Web/HTTP/Guides/CORS) or [Mixed Content](https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content) policy violation. The browser does not allow the JS code to clarify the real reason for the error caused by security issues, so please check the console. | | ERR_NETWORK | Network-related issue. In the browser, this error can also be caused by a [CORS](https://developer.mozilla.org/ru/docs/Web/HTTP/Guides/CORS) or [Mixed Content](https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content) policy violation. The browser does not allow the JS code to clarify the real reason for the error caused by security issues, so please check the console. |
| ERR_FR_TOO_MANY_REDIRECTS | Request is redirected too many times; exceeds max redirects specified in axios configuration. | | ERR_FR_TOO_MANY_REDIRECTS | Request is redirected too many times; exceeds max redirects specified in axios configuration. |
| ERR_BAD_RESPONSE | Response cannot be parsed properly or is in an unexpected format. Usually related to a response with `5xx` status code. | | ERR_BAD_RESPONSE | Response cannot be parsed properly or is in an unexpected format. Usually related to a response with `5xx` status code. |
@ -878,7 +878,7 @@ Below is a list of potential axios identified error:
## Handling Errors ## Handling Errors
the default behavior is to reject every response that returns with a status code that falls out of the range of 2xx and treat it as an error. The default behavior is to reject every response that returns with a status code that falls out of the range of 2xx and treat it as an error.
```js ```js
axios.get('/user/12345') axios.get('/user/12345')
@ -925,7 +925,7 @@ axios.get('/user/12345')
### AbortController ### AbortController
Starting from `v0.22.0` Axios supports AbortController to cancel requests in fetch API way: Starting from `v0.22.0` Axios supports AbortController to cancel requests in a fetch API way:
```js ```js
const controller = new AbortController(); const controller = new AbortController();
@ -1239,7 +1239,7 @@ All files will be sent with the same field names: `files[]`.
## 🆕 HTML Form Posting (browser) ## 🆕 HTML Form Posting (browser)
Pass HTML Form element as a payload to submit it as `multipart/form-data` content. Pass an HTML Form element as a payload to submit it as `multipart/form-data` content.
```js ```js
await axios.postForm('https://httpbin.org/post', document.querySelector('#htmlForm')); await axios.postForm('https://httpbin.org/post', document.querySelector('#htmlForm'));
@ -1351,7 +1351,7 @@ const {data} = await axios.post(SERVER_URL, readableStream, {
> **⚠️ Warning** > **⚠️ Warning**
> It is recommended to disable redirects by setting maxRedirects: 0 to upload the stream in the **node.js** environment, > It is recommended to disable redirects by setting maxRedirects: 0 to upload the stream in the **node.js** environment,
> as follow-redirects package will buffer the entire stream in RAM without following the "backpressure" algorithm. > as the follow-redirects package will buffer the entire stream in RAM without following the "backpressure" algorithm.
## 🆕 Rate limiting ## 🆕 Rate limiting
@ -1372,8 +1372,8 @@ const {data} = await axios.post(LOCAL_SERVER_URL, myBuffer, {
Axios has its own `AxiosHeaders` class to manipulate headers using a Map-like API that guarantees caseless work. Axios has its own `AxiosHeaders` class to manipulate headers using a Map-like API that guarantees caseless work.
Although HTTP is case-insensitive in headers, Axios will retain the case of the original header for stylistic reasons Although HTTP is case-insensitive in headers, Axios will retain the case of the original header for stylistic reasons
and for a workaround when servers mistakenly consider the header's case. and as a workaround when servers mistakenly consider the header's case.
The old approach of directly manipulating headers object is still available, but deprecated and not recommended for future usage. The old approach of directly manipulating the headers object is still available, but deprecated and not recommended for future usage.
### Working with headers ### Working with headers
@ -1465,7 +1465,7 @@ set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean);
``` ```
The `rewrite` argument controls the overwriting behavior: The `rewrite` argument controls the overwriting behavior:
- `false` - do not overwrite if header's value is set (is not `undefined`) - `false` - do not overwrite if the header's value is set (is not `undefined`)
- `undefined` (default) - overwrite the header unless its value is set to `false` - `undefined` (default) - overwrite the header unless its value is set to `false`
- `true` - rewrite anyway - `true` - rewrite anyway
@ -1554,7 +1554,7 @@ Returns `true` if at least one header has been cleared.
If the headers object was changed directly, it can have duplicates with the same name but in different cases. If the headers object was changed directly, it can have duplicates with the same name but in different cases.
This method normalizes the headers object by combining duplicate keys into one. This method normalizes the headers object by combining duplicate keys into one.
Axios uses this method internally after calling each interceptor. Axios uses this method internally after calling each interceptor.
Set `format` to true for converting headers name to lowercase and capitalize the initial letters (`cOntEnt-type` => `Content-Type`) Set `format` to true for converting header names to lowercase and capitalizing the initial letters (`cOntEnt-type` => `Content-Type`)
```js ```js
const headers = new AxiosHeaders({ const headers = new AxiosHeaders({
@ -1587,7 +1587,7 @@ Returns a new `AxiosHeaders` instance.
toJSON(asStrings?: boolean): RawAxiosHeaders; toJSON(asStrings?: boolean): RawAxiosHeaders;
```` ````
Resolve all internal headers values into a new null prototype object. Resolve all internal header values into a new null prototype object.
Set `asStrings` to true to resolve arrays as a string containing all elements, separated by commas. Set `asStrings` to true to resolve arrays as a string containing all elements, separated by commas.
### AxiosHeaders.from(thing?) ### AxiosHeaders.from(thing?)
@ -1643,7 +1643,7 @@ const fetchAxios = axios.create({
const {data} = fetchAxios.get(url); const {data} = fetchAxios.get(url);
``` ```
The adapter supports the same functionality as `xhr` adapter, **including upload and download progress capturing**. The adapter supports the same functionality as the `xhr` adapter, **including upload and download progress capturing**.
Also, it supports additional response types such as `stream` and `formdata` (if supported by the environment). Also, it supports additional response types such as `stream` and `formdata` (if supported by the environment).
### 🔥 Custom fetch ### 🔥 Custom fetch