不知道算不算个bug,header 属性名会自动大写转小写
发布于 3 年前 作者 xiulanlei 12091 次浏览 来自 问答

在服务端设置自定义Header属性名tokenId,少部分手机小程序返回结果获取时属性名为tokenid,自动有大写转小写了。

刚好发现,只是反馈下,一般用不到。

接口返回tokenId。
wx.request({
  url: 'example.php', 
  header: {
    'content-type': 'application/json' // 默认值
  },
  success (res) {
    console.log(res.header['tokenId']) //部分手机获取失败
    console.log(res.header['tokenid']) //部分手机获取成功
  } 
})
回到顶部