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

Fix FormData example (#4391)

You need to have form.getBuffer() in order for the FormData library to submit from node.

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Nicholas Juntilla
2022-03-06 23:45:12 -08:00
committed by GitHub
parent 45cb5ad716
commit 3d13b67c56
+1 -1
View File
@@ -844,7 +844,7 @@ form.append('my_field', 'my value');
form.append('my_buffer', new Buffer(10));
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
axios.post('https://example.com', form, { headers: form.getHeaders() })
axios.post('https://example.com', form.getBuffer(), { headers: form.getHeaders() })
```
Alternatively, use an interceptor: