append(key: string, value: string | File): void
Type | Description |
void | No data returned. |
import http from 'pts/http';const data = open('./sample/tmp.js');export default function () {const formData = new http.FormData();// Add data with value as string.formData.append('text', 'text');// Add data with value as File.formData.append('file', http.file(data, 'tmp.js'));const resp = http.post('http://httpbin.org/post', formData.body(), {headers: {'Content-Type': formData.contentType()}});console.log('formData: ', resp.body);};