uni.request({
url: 'http://api.worker.lililizi.top/api/app/cusUser/login/pwd', //仅为示例,并非真实接口地址。
method: "POST",
data: { mobilePhone:'18049019835', password:'123456' },
sslVerify: false,
success: (res) => {
console.log(res.data);
}
});
- 发布:2020-12-01 22:04
- 更新:2020-12-21 10:37
- 阅读:2456
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: OS Big Sur
HBuilderX类型: 正式
HBuilderX版本号: 2.9.8
手机系统: Android
手机系统版本号: Android 8.0
手机厂商: 所有
手机机型: 所有安卓机
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
uni.request({
url: 'http://api.worker.lililizi.top/api/app/cusUser/login/pwd', //仅为示例,并非真实接口地址。
method: "POST",
data: { mobilePhone:'18049019835', password:'123456' },
sslVerify: false,
success: (res) => {
console.log(res.data);
}
});
uni.request({
url: 'http://api.worker.lililizi.top/api/app/cusUser/login/pwd', //仅为示例,并非真实接口地址。
method: "POST",
data: { mobilePhone:'18049019835', password:'123456' },
sslVerify: false,
success: (res) => {
console.log(res.data);
}
});
预期结果:
正常请求
正常请求
实际结果:
{
"errMsg": "request:fail abort statusCode:-1",
"config": {
"baseURL": "http://api.worker.lililizi.top",
"method": "POST",
"url": "/api/app/cusUser/login/pwd",
"params": {},
"custom": {
"auth": true
},
"header": {
"Authorization": "",
"Content-Type": "application/json"
},
"validateStatus": "function() { [native code] }",
"data": {
"mobilePhone": "ggg",
"password": "ggg"
},
"dataType": "json",
"sslVerify": false,
"firstIpv4": false
}
}
{
"errMsg": "request:fail abort statusCode:-1",
"config": {
"baseURL": "http://api.worker.lililizi.top",
"method": "POST",
"url": "/api/app/cusUser/login/pwd",
"params": {},
"custom": {
"auth": true
},
"header": {
"Authorization": "",
"Content-Type": "application/json"
},
"validateStatus": "function() { [native code] }",
"data": {
"mobilePhone": "ggg",
"password": "ggg"
},
"dataType": "json",
"sslVerify": false,
"firstIpv4": false
}
}
bug描述:
HBuilderX2.9.8 和 最新的 2.9.11 都试过了,云打包自定义基座,会报"errMsg": "request:fail abort statusCode:-1",
云打包正式版,点击没有反应估计也是这个问题,
选择标准基座,就没有问题浏览器看也没有问题,
其他的不管怎么弄,就报这个错误"errMsg": "request:fail abort statusCode:-1"
uni.request({
url: 'http://api.worker.lililizi.top/api/app/cusUser/login/pwd', //仅为示例,并非真实接口地址。
method: "POST",
data: {
},
success: (res) => {
console.log(res.data);
}
});
报bug模板选错了,你要报的问题我猜是Android app的问题,而且我猜是证书的问题。仔细看request api文档,里面写了。
另外,为什么让我猜呢?为什么不能认真反馈呢?我要是猜不出来就不理你呢?
-
1***@qq.com (作者)
{
"errMsg": "request:fail abort statusCode:-1",
"config": {
"baseURL": "http://api.worker.lililizi.top",
"method": "POST",
"url": "/api/app/cusUser/login/pwd",
"params": {},
"custom": {
"auth": true
},
"header": {
"Authorization": "",
"Content-Type": "application/json"
},
"validateStatus": "function() { [native code] }",
"data": {
"mobilePhone": "ggg",
"password": "ggg"
},
"dataType": "json",
"sslVerify": false,
"firstIpv4": false
}
}2020-12-02 10:07
HBuilderX 3.0.0+ 已修复
-
回复 DCloud_UNI_GSQ: 应该是ssl证书的问题,配置了sslVerify:false,但是离线打包的时候还是走了验证,报错javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.请问下还有其他地方需要配置的吗?
2021-10-26 10:36
Nicole0724
不包含中文也遇到这个问题
2022-02-21 17:29
DCloud_Android_DQQ
回复 Nicole0724: 你新提ask。这个提问者的问题是这个原因导致。
2022-02-21 17:49