Getting json body in aws Lambda via API gateway

前端 未结 4 777
鱼传尺愫
鱼传尺愫 2020-12-02 16:40

I\'m currently using NodeJS to build a bot on AWS lambda via AWS Api Gateway and I\'m running into an issue with POST requests and JSON data. My api uses \'Use Lambda Proxy

4条回答
  •  醉话见心
    2020-12-02 16:55

    You may have forgotten to define the Content-Type header. For example:

      return {
        statusCode: 200,
        headers: {
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({ items }),
      }
    

提交回复
热议问题