使用的是post请求请求josn数据,但是发现数据可以传递给云函数,但是云函数获取到的内容被加了“\r\n”,导致数据不匹配,数据返回错误,但是不知道是什么原因导致的,求大佬解答。
云函数图片:
API请求图片:
云函数运行日志:(部分内容已隐藏)
请求入参: {
"args": {
"path": "/",
"httpMethod": "POST",
"headers": {
"content-length": "143",
"x5-uuid": "eb3493****4b19",
"x-client-ip": "39.154.168.57",
"x-forwarded-for": "39****57, 1****25, 3****0",
"accept": "/",
"x-real-ip": "3****7",
"x-sinfo": "on",
"host": "fc-mp-19****p.com",
"content-type": "application/json",
"x-forwarded-by": "1****6:80",
"cache-control": "no-cache",
"accept-encoding": "gzip, deflate, br",
"user-agent": "PostmanRuntime-ApipostRuntime/1.1.0"
},
"queryStringParameters": {},
"isBase64Encoded": false,
"body": "{\r\n \"_id\":\"669d3d27286f7c509f430259\",\r\n \"nickName\":\"111111\",\r\n \"mp_wx_openid\":\"222\",\r\n \"avatarUrl\":\"1uel\",\r\n \"group\":\"access\"\r\n}"
},
"requestId": "a****172054"
}
[CadminUpuser/ac1cd3741721918273133172054/47ms/ERROR] 查询参数对象值不能均为undefined
Error: 查询参数对象值不能均为undefined
at where (/tmp/function/@dcloudio/serverless/lib/aliyun/uni-cloud.js:1:41900)
at exports.main (/tmp/function/__index.js:8:40)
at Q (/tmp/function/index.js:1:24487)
at z (/tmp/function/index.js:1:25550)
at ce (/tmp/function/index.js:1:26520)
at runUserFunction (/code/index.js:93:265124)
at (/code/index.js:93:259283)
请求响应状态: fail
1***@qq.com (作者)
使用postapi发送的就是json数据
2024-07-26 16:16