返回响应体
{"responseCode":200,"cookies":"","header":{"content-length":"1744","content-type":"application/json; charset=utf-8","date":"Wed, 06 Mar 2024 08:26:49 GMT","server":"nginx"},"result":{},"resultType":2,"performanceTiming":{"dnsTiming":0.159,"firstReceiveTiming":1301.064,"firstSendTiming":0.409,"redirectTiming":0,"responseBodyTiming":1302.414,"responseHeaderTiming":1302.405,"tcpTiming":0,"tlsTiming":0,"totalFinishTiming":1301.302,"totalTiming":1303.02}}
http.createHttp().request(
`https://preapps.eshiyun.info/account/image/getCode?uuid=${this.generateRandomNumber(32)}`,
{
expectDataType: http.HttpDataType.ARRAY_BUFFER,
method: http.RequestMethod.GET,
header: {
// 在每个请求前添加自定义头部信息
'User-Agent': 'OS/Android:14 smyapp/standardsmy Brand/Xiaomi:2211133C Display/1080*2252 standardsmy/2.7.5.02',
'eshimin-version': '2.7.5.02',
'system-version': '14',
'nonce': randomChar,
'timeStamp': currentTime.toString(),
'sign': sign,
'uri': '/account/image/getCode',
'hversion': '2.1',
'tgt': tgt,
'token': tgt
}
}
可以在回调方法内通过 ArrayBuffer 参数接收,再打印字节长度来判断响应内容是否为空,如