added support for cache keys from header mappings, (e.g. method.request.body) #72
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
HI @DianaIonita!
Similar to PR #65, I needed a way to configure API Gateway to cache responses from my GraphQL Lambda function using
method.request.body
as a cache key.In order to prevent breaking changes, my solution was to branch off of the existing code if the
cacheKeyParameter
includes avalue
property, which indicates the cache key is from a mapped HTTP header. This new functionality also opens up the possibility of using other values likecontext.VARIABLE_NAME
in mapping expressions as well.I have updated the README and added additional tests to document this new functionality.
With the following configuration, I was able to achieve my desired configuration for a sample
/graphql
endpoint:GET
![image](https://user-images.githubusercontent.com/2754894/91897257-a0ad9480-ec5f-11ea-8645-6da40d1b50c9.png)
POST
![image](https://user-images.githubusercontent.com/2754894/91897045-54625480-ec5f-11ea-89c2-fc06c0870307.png)