tencent cloud

FormData.body
Last updated: 2025-03-10 17:04:49
FormData.body
Last updated: 2025-03-10 17:04:49
Form.body is used to return the form-data content, and it cannot be appended after being called.
body(): ArrayBuffer

Return

Type
Description
ArrayBuffer
Request body content.

Samples

import http from 'pts/http';

const data = open('./sample/tmp.js');

export default function () {
const formData = new http.FormData();
formData.append('text', 'text');
formData.append('file', http.file(data, 'tmp.js'));
// Output [object ArrayBuffer].
console.log(formData.body());
const resp = http.post('http://httpbin.org/post', formData.body(), {
headers: {'Content-Type': formData.contentType()}
});
console.log('formData: ', resp.body);
};

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback