我是用的api调用,非云函数
返回值
res: { status: 200,
statusCode: 200,
statusMessage: 'OK',
headers:
{ connection: 'keep-alive',
date: 'Fri, 01 May 2020 09:37:33 GMT',
'content-type': 'application/json; encoding=utf-8',
'content-length': '77' },
size: 77,
aborted: false,
rt: 159,
keepAliveSocket: false,
data: <Buffer 7b 22 65 72 72 63 6f 64 65 22 3a 34 32 30 30 31 2c 22 65 72 72 6d 73 67 22 3a 22 61 63 63 65 73 73 5f 74 6f 6b 65 6e 20 65 78 70 69 72 65 64 20 68 69 ... >,
requestUrls:
[ 'https://api.weixin.qq.com/wxa/getwxacode?access_token=32_7V1_3b0KepeMnGdvGI1-wHsnaOAvvcxMUcaRCaeEg-w9uNlXsgi8KBo0tbWI7ZNd7PIhRMN7fJnnJLwUtRu08NEJExpon55vUdvPmRCNnf7Epg-2j4TP6jYxgXDDhuUcS320RprYrekOuUKwLRBiAIACIS' ],
timing: null,
remoteAddress: 'xxx.xxx.xxx.xx',
remotePort: 443,
socketHandledRequests: 1,
socketHandledResponses: 1 }
content-type': 'application/json 如果返回这个,那就是接口报错了 不报错返回content-type': 'image/jpeg
我用的unicloud,请求代码如下
let res = await uniCloud.httpclient.request( `https://api.weixin.qq.com/wxa/getwxacode?access_token=${access_token}`, { method: 'POST', data })