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

!5633 翻译完成 5445:【misc软件服务系统】适配request部件

Merge pull request !5633 from ester.zhou/TR-5445
......@@ -7,7 +7,7 @@
## Modules to Import
```
```js
import request from '@ohos.request';
```
......@@ -84,8 +84,10 @@ Uploads files. This API uses a promise to return the result.
```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));
......@@ -114,8 +116,10 @@ Uploads files. This API uses an asynchronous callback to return the result.
```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.
先完成此消息的编辑!
想要评论请 注册