未验证 提交 eeddf4c7 编写于 作者: O openharmony_ci 提交者: Gitee

!5447 【misc软件服务子系统】适配request部件

Merge pull request !5447 from wangdongqi/cherry-pick-1655286904
......@@ -85,8 +85,10 @@ upload(config: UploadConfig): Promise<UploadTask>
```js
let file1 = { filename: "test", name: "test", uri: "internal://cache/test.jpg", type: "jpg" };
let data = { name: "name123", value: "123" };
let header = { key1: value1, key2: value2 };
let uploadTask;
request.upload({ url: 'https://patch', files: [file1] }).then((data) => {
request.upload({ url: 'https://patch', header: header, method: "POST", files: [file1], data: [data] }).then((data) => {
uploadTask = data;
}).catch((err) => {
console.error('Failed to request the upload. Cause: ' + JSON.stringify(err));
......@@ -115,8 +117,10 @@ upload(config: UploadConfig, callback: AsyncCallback<UploadTask>): void
```js
let file1 = { filename: "test", name: "test", uri: "internal://cache/test.jpg", type: "jpg" };
let data = { name: "name123", value: "123" };
let header = { key1: value1, key2: value2 };
let uploadTask;
request.upload({ url: 'https://patch', files: [file1] }, (err, data) => {
request.upload({ url: 'https://patch', header: header, method: "POST", files: [file1], data: [data] }, (err, data) => {
if (err) {
console.error('Failed to request the upload. Cause: ' + JSON.stringify(err));
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册