StarpTech / apollo-datasource-http

Optimized JSON HTTP Data Source for Apollo Server
MIT License
73 stars 32 forks source link

feat: make POST requests cacheable #24

Closed dwrBad closed 2 years ago

dwrBad commented 2 years ago

This PR is related to https://github.com/StarpTech/apollo-datasource-http/issues/19

It makes POST requests cacheable. Default behavior will still be the same – only GET requests will be cached. But you may manually overwrite isRequestCacheable() to define a default behaviour. Additionaly you should/must overwrite onCacheKeyCalculation to define an adequate caching key (including the body for example).

StarpTech commented 2 years ago

Hi @dwrBad thank you for the PR. Before I review this PR we need to wait for https://github.com/StarpTech/apollo-datasource-http/pull/26. Please update this branch after the merge.

dwrBad commented 2 years ago

Hi @StarpTech I adjusted the code to fix the behaviour with the changes from #26 and updated the branch. Thank you for looking into it!

llc1123 commented 2 years ago

+1 on this PR. LGTM.