API Gateway "Unsupported Media Type" Error when sending application/x-www-form-urlencoded data

1

Hello Team

I am creating a REST API that accepts data with Content-Type of application/x-www-form-urlencoded. I test the api in aws but receive 415 error, Unsupported Media Type.

I have tried setting up the API based on the questions and answers here and here but have not been able to resolve the error. The settings are shown below. Please help me with this.

Thanks.

API Result

  • Headers
    • Content-Type:application/x-www-form-urlencoded
  • Request Body
    • a=1

ここに画像の説明を入力してください

Method Request

  • All default settings.

ここに画像の説明を入力してください

Integration Request

  • Request body passthrough
    • When there are no templates defined (recommended)
  • Mapping Template
    • application/x-www-form-urlencoded

ここに画像の説明を入力してください

Integration Response

  • Mapping Template
    • application/json
    • application/x-www-form-urlencoded
      • Both specify the same Json template.

ここに画像の説明を入力してください

Method Response

  • All default settings.

ここに画像の説明を入力してください

Settings

  • Binary Media Types
    • application/x-www-form-urlencoded

ここに画像の説明を入力してください

1개 답변
1

Hi, you should read in detail: https://blog.summercat.com/using-aws-lambda-and-api-gateway-as-html-form-endpoint.html

Its section Configuring API Gateway provides a way to use Integations to handle type application/x-www-form-urlencoded

profile pictureAWS
전문가
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인