dougmoscrop / serverless-http

Use your existing middleware framework (e.g. Express, Koa) in AWS Lambda 🎉
Other
1.72k stars 166 forks source link

Adding binary content-type wildcard support #46

Closed kgroat closed 6 years ago

kgroat commented 6 years ago

This adds support for wildcard content-type to be used in the array or environment variable used to determine if a response should be binary encoded.

dougmoscrop commented 6 years ago

Cool! When I last tested this in apig itself, it didn't work. Has that been fixed (or did I test wrong)?

kgroat commented 6 years ago

According to API Gateway, they look at not just the outgoing Content-Type header, but also the incoming Accepts header, which means that a type of image/* would trigger binary processing if the browser sends it in the Accepts header.

This would then just ensure that if the outgoing Content-Type matches the same wildcard, it would get processed correctly

dougmoscrop commented 6 years ago

sorry for taking so long to get back to this.

ok, so, you changes are fair in that they work locally, but I'm still uncertain about API gateway behavior. we could at least document it better but I'm gonna merge this then do some more testing / docs.

dougmoscrop commented 6 years ago

Added an integration test and released at 1.6.0

ceefour commented 5 years ago

ok, so, you changes are fair in that they work locally, but I'm still uncertain about API gateway behavior. we could at least document it better but I'm gonna merge this then do some more testing / docs.

@dougmoscrop Please see detailed API Gateway behavior here: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings-workflow.html