| 177 | } |
| 178 | |
| 179 | headers(method, apiPath, data, extra = {}) { |
| 180 | return { |
| 181 | Authorization: this.token ? `Bearer ${this.token}` : "Bearer ", |
| 182 | "X-Visitor": this.visitor, |
| 183 | "X-Platform": "mini", |
| 184 | SIGN: this.getSign(method, apiPath, data), |
| 185 | "Content-Nonce": "", |
| 186 | "User-Agent": USER_AGENT, |
| 187 | Referer: `https://servicewechat.com/${MINI_APP_ID}/${PAGE_VERSION}/page-frame.html`, |
| 188 | ...extra, |
| 189 | }; |
| 190 | } |
| 191 | |
| 192 | async request(apiPath, data = {}, options = {}) { |
| 193 | const method = (options.method || "POST").toUpperCase(); |