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

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

Kenryo
feita há um ano2608 visualizações
1 Resposta
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
ESPECIALISTA
respondido há um ano

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas