我正在使用无服务器部署我的api;
functions:
# hello:
# handler: index.handler
# events:
# - http: ANY /
# - http: 'ANY {proxy+}'
addAnnouncement:
handler: index.handler
events:
- http:
method: POST
path: /abc/{foo}/cde/efg
cors: true
integration: lambda
request:
parameters:
paths:
foo: true
- http:
method: DELETE
path: /abc/{foo}/cde/efg
cors: true
integration: lambda
request:
parameters:
paths:
foo: true
- http:
method: GET
path: /abc/{foo}/cde/efg
cors: true
integration: lambda
request:
parameters:
paths:
foo: true
我的api路由如下所示;
当我点击api-gateway-url时出现以下错误
{
"errorMessage": "event.body was an object but content-type is not json",
"errorType": "Error",
"stackTrace": [
"getBody (/var/task/node_modules/serverless-http/lib/request.js:24:13)",
"new ServerlessRequest (/var/task/node_modules/serverless-http/lib/request.js:44:18)",
"Promise.resolve.then (/var/task/node_modules/serverless-http/serverless-http.js:30:25)",
"<anonymous>"
]
}