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
preguntada hace un año2610 visualizaciones
1 Respuesta
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
EXPERTO
respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas