flask-lambda
flask-lambda copied to clipboard
fix potential none reference and truncated response body when loading static files
When clicking the test button in api gateway

I get an error

I logged out the event as json and found that headers was null

This commit adds a guard for if the headers is null, in addition initializes a few keys in the environ to an empty string to prevent key errors.
I also experience and error where all of the responses were truncated to only the first 8192 bytes when sending a static file. This is because the wsgi_app returns and iterator with an 8192k buffer, so the iterator must be exhausted to get the entire body.