[wepy] modifying wx.request params (#27049)

* [wepy] modifying wx.request params

* updating code owners
This commit is contained in:
Jiayu Liu
2018-07-05 10:07:52 -07:00
committed by Mohamed Hegazy
parent 6361591c22
commit f83dee6c0e
3 changed files with 29 additions and 2 deletions
+2
View File
@@ -4374,6 +4374,8 @@
/types/weighted/ @ccitro
/types/weixin-app/ @taoqf @AlexStacker
/types/wellknown/ @yairtawil
/types/wepy/ @Jimexist
/types/wepy-redux/ @Jimexist
/types/whatwg-mimetype/ @petejohanson
/types/whatwg-streams/ @saschanaz @ksm2
/types/whatwg-url/ @aomarks
+10 -1
View File
@@ -21,8 +21,17 @@ export class MyComponent extends wepy.component {
methods = {};
onLoad() {
async onLoad() {
super.onLoad();
await wepy.request("http://www.weixin.com");
const a = await wepy.request({
url: "www.weixin.com",
data: { a: 1, b: 2 },
header: {
"content-type": "application/json"
},
method: "POST"
});
}
}
+17 -1
View File
@@ -114,6 +114,22 @@ export interface UrlParam {
url: string;
}
export interface RequestParam extends UrlParam {
data?: object | string | ArrayBuffer;
header?: object;
method?:
| "GET"
| "OPTIONS"
| "HEAD"
| "POST"
| "PUT"
| "DELETE"
| "TRACE"
| "CONNECT";
dataType?: "json" | "text";
responseType?: "text" | "arraybuffer";
}
export interface FilePathParam {
filePath: string;
}
@@ -332,7 +348,7 @@ export interface WxEnhances {
removeStorage(params: { key: string }): Promise<void>;
request(params: UrlParam): Promise<any>;
request(params: RequestParam | string): Promise<any>;
requestPayment(params: {
timeStamp: string;