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
エキスパート
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ