body(): ArrayBuffer
Type | Description |
ArrayBuffer | Request body content. |
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);};