diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 247c8ab6a4..fb6f7ba030 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -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 diff --git a/types/wepy/wepy-tests.ts b/types/wepy/wepy-tests.ts index 071eda0d9e..c0fb4b3d89 100644 --- a/types/wepy/wepy-tests.ts +++ b/types/wepy/wepy-tests.ts @@ -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" + }); } } diff --git a/types/wepy/wx_enhanced.d.ts b/types/wepy/wx_enhanced.d.ts index d5e66dea34..5769c4f718 100644 --- a/types/wepy/wx_enhanced.d.ts +++ b/types/wepy/wx_enhanced.d.ts @@ -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; - request(params: UrlParam): Promise; + request(params: RequestParam | string): Promise; requestPayment(params: { timeStamp: string;