2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-15 11:59:42 +03:00

Fix typo and formatting, add colons (#4853)

* Fix typo, add colons

* Fix code formatting

* Fix code formatting

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Karl Horky
2022-09-15 07:21:40 +02:00
committed by GitHub
parent 738fa63661
commit d57fdb6510
+7 -7
View File
@@ -515,7 +515,7 @@ These are the available config options for making requests. Only the `url` is re
},
formSerializer: {
visitor: (value, key, path, helpers)=> {}; // custom visitor funaction to serrialize form values
visitor: (value, key, path, helpers) => {}; // custom visitor funaction to serrialize form values
dots: boolean; // use dots instead of brackets format
metaTokens: boolean; // keep special endings like {} in parameter key
indexes: boolean; // array indexes format null - no brackets, false - empty brackets, true - brackets with indexes
@@ -965,7 +965,7 @@ axios.post('https://httpbin.org/post', {x: 1}, {
headers: {
'Content-Type': 'multipart/form-data'
}
}).then(({data})=> console.log(data));
}).then(({data}) => console.log(data));
```
In the `node.js` build, the ([`form-data`](https://github.com/form-data/form-data)) polyfill is used by default.
@@ -974,14 +974,14 @@ You can overload the FormData class by setting the `env.FormData` config variabl
but you probably won't need it in most cases:
```js
const axios= require('axios');
const axios = require('axios');
var FormData = require('form-data');
axios.post('https://httpbin.org/post', {x: 1, buf: new Buffer(10)}, {
headers: {
'Content-Type': 'multipart/form-data'
}
}).then(({data})=> console.log(data));
}).then(({data}) => console.log(data));
```
Axios FormData serializer supports some special endings to perform the following operations:
@@ -1023,7 +1023,7 @@ const obj = {
The following steps will be executed by the Axios serializer internally:
```js
const formData= new FormData();
const formData = new FormData();
formData.append('x', '1');
formData.append('arr[]', '1');
formData.append('arr[]', '2');
@@ -1043,7 +1043,7 @@ which are just the corresponding http methods with the `Content-Type` header pre
## Files Posting
You can easily sumbit a single file
You can easily submit a single file:
```js
await axios.postForm('https://httpbin.org/post', {
@@ -1052,7 +1052,7 @@ await axios.postForm('https://httpbin.org/post', {
});
```
or multiple files as `multipart/form-data`.
or multiple files as `multipart/form-data`:
```js
await axios.postForm('https://httpbin.org/post', {