ashiina/lambda-local

Content-type header should not be required for get requests

jonniedarko opened this issue · 1 comments

Currently You cannot make a Get request if content-type header is not set to application/json(e.g. via browser)

This is not standard behaviour, Content heard should only be required for request with a body, e.g. POST, PUT (maybe if GET has a body?)

see https://www.rfc-editor.org/rfc/rfc7231#section-3.1.1.5

A sender that generates a message containing a payload body SHOULD
generate a Content-Type header field in that message unless the
intended media type of the enclosed representation is unknown to the
sender. If a Content-Type header field is not present, the recipient
MAY either assume a media type of "application/octet-stream"
([RFC2046], Section 4.5.1) or examine the data to determine its type.

efess commented

Not sure this is an issue - I believe all invocations of a lambda function are POST. If you're trying to implement GET in your lambda function and want to call that, you'll have to POST a payload such as the one in this example:

https://github.com/ashiina/lambda-local/blob/develop/examples/event_apigateway.js