mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
docs: fix typos and grammar in advanced docs (#10905)
- error-handling: "get a object" -> "get an object" - request-config: add missing comma in transformRequest return type list (Buffer, ArrayBuffer, FormData or Stream) to match README.md and the es/zh/fr translations - x-www-form-urlencoded-format: add missing space after comma in "browsers,and [Node]" Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
@@ -64,7 +64,7 @@ axios.get("/user/12345", {
|
||||
});
|
||||
```
|
||||
|
||||
Using the `toJSON` method, you can get a object with more information about the error.
|
||||
Using the `toJSON` method, you can get an object with more information about the error.
|
||||
|
||||
```js
|
||||
axios.get("/user/12345").catch(function (error) {
|
||||
|
||||
@@ -33,7 +33,7 @@ The `allowAbsoluteUrls` determines whether or not absolute URLs will override a
|
||||
|
||||
### `transformRequest`
|
||||
|
||||
The `transformRequest` function allows you to modify the request data before it is sent to the server. This function is called with the request data as its only argument. This is only applicable for request methods `PUT`, `POST`, `PATCH` and `DELETE`. The last function in the array must return a string or an instance of Buffer, ArrayBuffer FormData or Stream.
|
||||
The `transformRequest` function allows you to modify the request data before it is sent to the server. This function is called with the request data as its only argument. This is only applicable for request methods `PUT`, `POST`, `PATCH` and `DELETE`. The last function in the array must return a string or an instance of Buffer, ArrayBuffer, FormData or Stream.
|
||||
|
||||
### `transformResponse`
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## URLSearchParams
|
||||
|
||||
By default, axios serializes JavaScript objects to `JSON`. To send data in the [`application/x-www-form-urlencoded` format](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) instead, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API, which is [supported](http://www.caniuse.com/#feat=urlsearchparams) in the vast majority of browsers,and [Node](https://nodejs.org/api/url.html#url_class_urlsearchparams) starting with v10 (released in 2018).
|
||||
By default, axios serializes JavaScript objects to `JSON`. To send data in the [`application/x-www-form-urlencoded` format](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) instead, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API, which is [supported](http://www.caniuse.com/#feat=urlsearchparams) in the vast majority of browsers, and [Node](https://nodejs.org/api/url.html#url_class_urlsearchparams) starting with v10 (released in 2018).
|
||||
|
||||
```js
|
||||
const params = new URLSearchParams({ foo: 'bar' });
|
||||
|
||||
Reference in New Issue
Block a user