uni.request({
url: baseUrl + 'apis/' + url,
method: method ? method : 'GET',
data: data ? data: {},
headers: {
'mytoken': 'your-custom-value' // 自定义请求头
},
responseType: responseType ? responseType : 'json',
success: (res : any) => {
}
})
通过上面的代码发送post请求,抓包请求头中没有mytoken,后台也取不到mytoken,是不支持自定义请求头了吗
2 个回复
套马杆的套子 - 没有解决不了的问题,只有解决不完的问题
没有headers属性,给headers换成header试试,
Diligent_UI - 【插件开发】【专治疑难杂症】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=193663(微信搜索飘逸科技UI小程序直接体验)】【骗子请绕道】问题咨询请加QQ群:120594820,代表作灵感实用工具小程序
单词错了,是header