(method, url, token, options = {})
| 100 | } |
| 101 | |
| 102 | async function request(method, url, token, options = {}) { |
| 103 | const res = await axios({ |
| 104 | method, |
| 105 | url, |
| 106 | headers: buildHeaders(token), |
| 107 | timeout: 15000, |
| 108 | validateStatus: () => true, |
| 109 | ...options, |
| 110 | }); |
| 111 | |
| 112 | const newToken = getResponseToken(res.headers); |
| 113 | if (newToken && options.account) { |
| 114 | options.onToken?.(newToken); |
| 115 | updateCachedToken(options.account, newToken); |
| 116 | } |
| 117 | |
| 118 | return res; |
| 119 | } |
| 120 | |
| 121 | async function getWxCode(account) { |
| 122 | const wxServerUrl = process.env.wx_server_url; |
no test coverage detected