微信小程序的消息头增加的字段不能有下滑线,字段大写字母自动转换消息字母。这个是微信小程序的坑。
正式环境:
微信小程序的消息头增加了一个字段device_id,结果node.js打印出来的字段没有该字段。
javascript
[2024-12-20T09:45:54.476] [DEBUG] app - ctx.headers.device_id: undefined ctx.headers: {
host: '127.0.0.1:3046',
connection: 'close',
'content-length': '2',
source: '1',
'content-type': 'application/json',
authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjoiNHJ2cG82d3JzZHRzIiwiZXhwIjoxNzM2Njc2ODc0LCJpYXQiOjE3MzQwODQ4NzR9.SyB6dKv8OZGmeIGyWBLV1AaG_YMR88knEMnYEnsno1E',
version: '1.5.26',
'accept-encoding': 'gzip,compress,br,deflate',
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.49(0x18003137) NetType/WIFI Language/zh_CN',
referer: 'https://servicewechat.com/wx314ab78eb5fe6d92/28/page-frame.html'
}
字段是大写字母的自动转换消息字母。
javascript
[2024-12-20T09:56:00.005] [DEBUG] app - is_dev2: true
[2024-12-20T10:01:08.834] [DEBUG] app - ctx.headers.device_id: undefined ctx.headers: {
host: '106.75.184.186:8025',
connection: 'keep-alive',
'content-length': '2',
deviceid: '17332944379353078659',
authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjoiNHIyNzRybXJsaHE4IiwiZXhwIjoxNzM3MTgzNzM1LCJpYXQiOjE3MzQ1OTE3MzV9.ih6MXTiNYw_e4pGv8FpQeM5MDC-VWLKhj2s2bCxUCT4',
version: '',
source: '1',
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1 wechatdevtools/1.06.2409140 MicroMessenger/8.0.5 Language/zh_CN webview/',
'content-type': 'application/json',
accept: '*/*',
referer: 'https://servicewechat.com/wx314ab78eb5fe6d92/devtools/page-frame.html',
'accept-encoding': 'gzip, deflate'
}