开发工具不校验域名模式正常, 校验域名,后台服务器域名配置了也不管用报错:request:fail url not in domain list 测试版上报错:request protocol must be http or https
request报错 request protocol must be http or https ?return new Promise((reslove, reject) => { if (uni.getStorageSync('locale')) { header['Cb-lang'] = uni.getStorageSync('locale') } let api =httpUrl + '/api/' + url console.log(api,method || 'GET',header); uni.request({ url: api, method: method || 'GET', header: header, data: data || {}, timeout:120000, success: (res) => { if (noVerify) reslove(res.data, res); else if (res.data.status == 200) reslove(res.data, res); else if ([110002, 110003, 110004].indexOf(res.data.status) !== -1) { toLogin(); reject(res.data); } else if (res.data.status == 100103) { uni.showModal({ title: i18n.t(`提示`), content: res.data.msg, showCancel: false, confirmText: i18n.t(`我知道了`) }); } else reject(res.data.msg || i18n.t(`系统错误`)); }, fail: (msg) => { let data = { mag: i18n.t(`请求失败`), status: 1 //1没网 } console.log(msg,"fail"); } }) });
06-21怎么解决的?
小程序请求报错errno:600005{errMsg:"request:fail request protocol must be http or https”errno:600005} 小程序模拟器正常使用,体验版报错,目前出现报错的机型有(华为鸿蒙系统,小米红米安卓系统),我的协议是正常的,请求的域名也配置了 使用的框架是uniapp,目前报错主要出现在微信小程序, [图片][图片][图片][图片] request代码片段 [图片][图片] import {baseUrl} from './operate.js' // import store from '../store/index.js' export default class Request { http(param) { // 请求参数 var url = param.url, method = param.method, header = { ...param.header, // #ifdef MP-WEIXIN "source": 1, // #endif // #ifdef MP-ALIPAY "source": 2, // #endif 'content-type': "application/json", 'Applet-Authorization': uni.getStorageSync('token') }, data = param.data || {}, token = param.token || "", hideLoading = param.hideLoading || false; //拼接完整请求地址(根据环境切换) var requestUrl = baseUrl() + url; if (method) { method = method.toUpperCase(); //小写改为大写 } //加载圈 if (!hideLoading) { uni.showLoading({ title: '加载中...' }); } // 返回promise return new Promise((resolve, reject) => { console.error(requestUrl) // 请求 uni.request({ url: requestUrl, data: data, method: method, header: header, success: (res) => { if (res.statusCode && (res.statusCode != 200 || res.data.code !== 200)) { uni.showToast({ title: "api错误:" + res.data.msg, icon: 'none' }); return; } resolve(res.data) }, //请求失败 fail: (e) => { console.error('api报错:') console.error(e) console.error('请求URL:'+requestUrl) setTimeout(()=>{ uni.showToast({ title: "" + e.errMsg||e.data.msg, icon: 'none' }); }) resolve(e.data); }, //请求完成 complete() { //隐藏加载 if (!hideLoading) { console.log('complete') uni.hideLoading(); } resolve(); return; } }) }) }; get(param){ return new Promise((resolve, reject) => { this.http({ ...param, method: 'GET' }).then((res)=>{ resolve(res) }).catch((err)=>{ reject(err) }) }) }; post(param){ return new Promise((resolve, reject) => { this.http({ ...param, method: 'POST' }).then((res)=>{ resolve(res) }).catch((err)=>{ reject(err) }) }) } }
06-21请问解决了吗?
小程序直播添加商品老是提示连接无效,官方页面提交也不行?小程序直播添加商品老是提示连接无效,官方页面提交也不行,一直报错[图片]
2022-10-19