Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api Gateway proxy event normalizer middleware #35

Closed
lmammino opened this issue Sep 26, 2017 · 0 comments
Closed

Api Gateway proxy event normalizer middleware #35

lmammino opened this issue Sep 26, 2017 · 0 comments

Comments

@lmammino
Copy link
Member

A common issue with Api gateway proxy event is that the keys:

pathParameters and queryStringParameters are created in the event if (and only if) at least one parameter exists.

this will lead to have to do the following tedious checks in the code:

console.log(event.queryStringParameters ? event.queryStringParameters.foo : undefined)

I'd love to have a middleware that takes care to normalize the event in this case and make sure we always have those key (mapped to an empty object) so that we don't need to have ternary conditions or a bunch of if statements every time we want to access one of those values in the collection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants