HTTPClient.prototype.multipartRequest()
APINetwork
以multipart/form-data的形式上传文件和表单
调用方法
参数介绍
- options: {headers, form, encoding, timeout, onResponse, onSuccess, onError}请求选项
- method: String请求类型
- headers: Object<name, value>请求的头部信息
- encoding: String传输的字节编码
- form: {fields, files}需要提交的表单内容
- fields: Object<field, [value ...]>表单中对应字段的数据,多个为数组
- files: Object<field, [file ...]>表单中对应字段的文件,多个为数组
- file: {filename, data, contentType}文件信息
- filename: String文件名
- data: Any文件内容(字符串、Readable或者Buffer)
- contentType: String文件类型(MIME)
- timeout: Number请求超时时间
- onResponse: (response) -> void当请求返回时的回调
- onSuccess: () -> void当请求返回成功时的回调
- onError: (error) -> void当请求失败时的回调
关联API
- HTTPClient()
- HTTPClient.prototype.download()
- HTTPClient.prototype.getCookies()
- HTTPClient.prototype.request()
- HTTPClient.prototype.setCookie()