From 7f1fe572504606db075207372c43431b7e87d7fb Mon Sep 17 00:00:00 2001 From: WuMingDao <146366930+WuMingDao@users.noreply.github.com> Date: Tue, 11 Nov 2025 14:34:36 +0800 Subject: [PATCH] docs: grammar issue in *.md (#7215) * fix readme.md * fix ECOSYSTEM.md * fix CONTRIBUTING.md --- CONTRIBUTING.md | 6 ++--- ECOSYSTEM.md | 6 ++--- README.md | 60 ++++++++++++++++++++++++------------------------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 23cfc79a..a19cee2c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,9 +20,9 @@ Please update the [documentation](https://axios-http.com/docs/intro) accordingly ## Developing -- `npm run test` run the jasmine and mocha tests -- `npm run build` run rollup and bundle the source -- `npm run version` prepare the code for release +- `npm run test` runs the jasmine and mocha tests +- `npm run build` runs rollup and bundles the source +- `npm run version` prepares the code for release ## Running Examples diff --git a/ECOSYSTEM.md b/ECOSYSTEM.md index e6886c8f..b0257fe3 100644 --- a/ECOSYSTEM.md +++ b/ECOSYSTEM.md @@ -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 * [@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-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-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 @@ -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. * [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) -* [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-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 @@ -39,7 +39,7 @@ This is a list of axios related libraries and resources. If you have a suggestio ### 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. -* [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 * [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 diff --git a/README.md b/README.md index 5e086714..090cf6e0 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ import axios from 'axios'; 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 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: '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 - // to methods of that instance. + // to the methods of that instance. baseURL: 'https://some-domain.com/api/', // `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. 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, options?: ParamsSerializerOptions ), // 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 - // Only applicable for request methods 'PUT', 'POST', 'DELETE , and 'PATCH' - // When no `transformRequest` is set, must be of one of the following types: + // Only applicable for request methods 'PUT', 'POST', 'DELETE', and 'PATCH' + // When no `transformRequest` is set, it must be of one of the following types: // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams // - Browser only: FormData, File, Blob // - 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' 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 // `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. // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and // 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`. // If the proxy server uses HTTPS, then you must set the protocol to `https`. proxy: { @@ -623,7 +623,7 @@ These are the available config options for making requests. Only the `url` is re ## Response Schema -The response for a request contains the following information. +The response to a request contains the following information. ```js { @@ -722,20 +722,20 @@ const instance = axios.create(); // Add a request interceptor instance.interceptors.request.use(function (config) { - // Do something before request is sent + // Do something before the request is sent return config; }, function (error) { - // Do something with request error + // Do something with the request error return Promise.reject(error); }); // Add a response interceptor 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 return response; }, 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 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 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. ```js @@ -793,7 +793,7 @@ axios.interceptors.request.use(function (config) { }, 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 @@ -832,7 +832,7 @@ instance.interceptors.response.use(interceptor('Response Interceptor 3')); ### Multiple Interceptors -Given you add multiple response interceptors +Given that you add multiple response interceptors and when the response was fulfilled - then each interceptor is executed - 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 - 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 -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: | 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'. | | 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 | -| 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. 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. | | 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). | -| 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_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. | @@ -878,7 +878,7 @@ Below is a list of potential axios identified error: ## 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 axios.get('/user/12345') @@ -925,7 +925,7 @@ axios.get('/user/12345') ### 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 const controller = new AbortController(); @@ -1239,7 +1239,7 @@ All files will be sent with the same field names: `files[]`. ## 🆕 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 await axios.postForm('https://httpbin.org/post', document.querySelector('#htmlForm')); @@ -1351,7 +1351,7 @@ const {data} = await axios.post(SERVER_URL, readableStream, { > **⚠️ Warning** > 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 @@ -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. 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. -The old approach of directly manipulating headers object is still available, but deprecated and not recommended for future usage. +and as a workaround when servers mistakenly consider the header's case. +The old approach of directly manipulating the headers object is still available, but deprecated and not recommended for future usage. ### Working with headers @@ -1465,7 +1465,7 @@ set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean); ``` 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` - `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. This method normalizes the headers object by combining duplicate keys into one. 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 const headers = new AxiosHeaders({ @@ -1587,7 +1587,7 @@ Returns a new `AxiosHeaders` instance. 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. ### AxiosHeaders.from(thing?) @@ -1643,7 +1643,7 @@ const fetchAxios = axios.create({ 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). ### 🔥 Custom fetch