可复现
l***@163.com
- 发布:2023-04-21 16:43
- 更新:2023-04-21 17:08
- 阅读:214
产品分类: uniCloud/App
操作步骤:
预期结果:
云函数可接收自定义header
云函数可接收自定义header
实际结果:
云函数不可接收自定义header
云函数不可接收自定义header
bug描述:
【报Bug】URL化的云函数,接收不到客户端传入的自定义header。
H5客户端通过http请求调用URL化的云函数,加了自定义header,但在云端云函数的headers中丢失。
l***@163.com (作者)
云函数获取不到header
2023-04-21 17:30
DCloud_uniCloud_CRL
回复 l***@163.com: 代码发一下。
2023-04-21 17:31
l***@163.com (作者)
回复 DCloud_uniCloud_CRL:
客户端:
var request = {
url: "https://c6eb464d-02f8-a29c-a530cf6b4ce1.bspapp.com/who_no_punch_in/" + obj.name,
method: 'POST',
data: obj.data,
header: {
initiator_app: 'H5',
'content-type': 'application/json'
}
};
wx.request(request);
云函数端:
请求入参: {
"args": {
"path": "/c_util",
"httpMethod": "POST",
"headers": {
"content-length": "226",
"referer": "http://www.fun24.fun/wnp/",
"x5-uuid": "d08a86fa0626948bd4aa4f465eecfa71",
"content-type": "application/json",
"eagleeye-ip": "172.20.29.172",
"eagleeye-pappname": "ec6403cc-bed2-4f38-8883-039cb4b87f02",
"accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
"eagleeye-prpc": "/http/*",
"eagleeye-pspanid": "-1",
"x-forwarded-for": "223.74.104.73, 39.96.130.120, 100.117.86.53, 192.168.181.165",
"accept": "/*",
"x-real-ip": "223.74.104.73",
"eagleeye-spanid": "7921789670918842308",
"x-requested-with": "com.tencent.mm",
"x-forwarded-by": "172.20.29.172:80",
"eagleeye-userdata": "mse_alf=0",
"user-agent": "Mozilla/5.0 (Linux; Android 10; ELE-AL00 Build/HUAWEIELE-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/4309 MMWEBSDK/20220402 Mobile Safari/537.36 MMWEBID/378 MicroMessenger/8.0.22.2140(0x28001657) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64"
},
"queryStringParameters": {},
"isBase64Encoded": false,
"body": "{\"type\":\"c_who_no_punch_in2\",\"all\":\"1.张三\n2.李四\n3.王五\n林黛玉\n大宝\",\"punched\":\"#接龙\n已打疫苗的请接龙\n\n1.张三\n2.李四\n3.王五\n4.孙六\n(请修改本清单后再查看谁没有接龙)\"}"
},
"requestId": "ac141dac1682044891373193437"
}
2023-04-21 18:13