Malformed request if my GET has body

31 views
Skip to first unread message

Son Nguyen

unread,
Nov 19, 2020, 12:31:56 PM11/19/20
to api-gateway-users
Hi guys,
For some reason, my Gateway will reject the GET request (POST works fine, not sure about the other verbs) if it has json body (I haven't tested other content types). API Gateway itself doesn't even log the request so I have no clue what's wrong. I specify in my yaml that the get consumes application/json.
Please find the attached yaml.
Thank you
api-gateway.yaml

Josh Einhorn

unread,
Nov 19, 2020, 3:25:23 PM11/19/20
to Son Nguyen, api-gateway-users
Unfortunately the HTTP protocol itself does not support sending a body with the GET method. Can you share the exact error returned to you?

-Josh

--
You received this message because you are subscribed to the Google Groups "api-gateway-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-gateway-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/api-gateway-users/63f5d5b8-1a20-470b-aa3f-839cadb0a8fdn%40googlegroups.com.


--
Josh Einhorn | Software Engineer | joshe...@google.com | 1-215-837-1102

Son Nguyen

unread,
Nov 20, 2020, 12:40:56 PM11/20/20
to api-gateway-users
Thanks Josh, I didn't know that. 

Josh Einhorn

unread,
Nov 30, 2020, 3:38:39 PM11/30/20
to api-gateway-users
Just circling back on this and wanted to call out an inaccuracy in my original message:

 > the HTTP protocol itself does not support sending a body with the GET method

It is not the HTTP protocol itself that forbids this, but rather a convention that is followed by almost all HTTP servers and clients. So it is technically allowed by HTTP to send a message using GET which includes a "body" (payload following the headers), however many servers will either drop the body silently or return an error of some sort.

-Josh

Reply all
Reply to author
Forward
0 new messages