contentType(): string
Type | Description |
string | The value of the ContentType field. |
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'));// Return "multipart/form-data; boundary=xxxxxx".console.log(formData.contentType());const resp = http.post('http://httpbin.org/post', formData.body(), {headers: {'Content-Type': formData.contentType()}});console.log('formData: ', resp.body);};