Can REST GET method in API Gateway support a request body? Does API Gateway drop the body?

0

I saw an earlier question but I have a specific question and some behavior from the server I can't find answers to.

Setup:

I have an API Gateway setup via VPC link. It has a GET method. It goes through a NLB and a ALB to a target EC2 hosting a SAP REST API. I see from the console and the REST spec that body requests for GET is not supported.

However, what will happen if someone sends a GET request WITH a body to the API gateway? Will API Gateway simply drop the body?

I presume the "best solution" here is to change it to a POST, if a request body is necessary?

2개 답변
0

I'm not 100% sure but I'd assume if you are using a Proxy request it would pass-through. But as a consumer, if you need a body, POST is the cleanest way and least confusing way for your consumers.

profile picture
bpyle
답변함 일 년 전
0

For GET requests the body payload will be dropped and the backend will receive a blank payload. However, if you want the body to pass through you can change the Method in VPC Link integration Request to POST while keeping the resource method as GET.

AWS
지원 엔지니어
답변함 일 년 전

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

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

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

관련 콘텐츠