apollo-datasource-http
Advanced tools
Comparing version 0.19.0 to 0.20.0
@@ -68,2 +68,3 @@ /// <reference types="node" /> | ||
protected isResponseCacheable<TResult = unknown>(request: Request, response: Response<TResult>): boolean; | ||
protected isRequestCacheable(request: Request): boolean; | ||
protected isRequestMemoizable(request: Request): boolean; | ||
@@ -70,0 +71,0 @@ protected onCacheKeyCalculation(request: Request): string; |
@@ -60,4 +60,7 @@ "use strict"; | ||
isResponseCacheable(request, response) { | ||
return statusCodeCacheableByDefault.has(response.statusCode) && request.method === 'GET'; | ||
return statusCodeCacheableByDefault.has(response.statusCode) && this.isRequestCacheable(request); | ||
} | ||
isRequestCacheable(request) { | ||
return request.method === 'GET'; | ||
} | ||
isRequestMemoizable(request) { | ||
@@ -206,3 +209,4 @@ return Boolean(request.memoize) && request.method === 'GET'; | ||
const cacheKey = this.onCacheKeyCalculation(request); | ||
if (request.method === 'GET') { | ||
const isRequestMemoizable = this.isRequestMemoizable(request); | ||
if (isRequestMemoizable) { | ||
if (this.memoizedResults.has(cacheKey)) { | ||
@@ -224,3 +228,4 @@ const response = await this.memoizedResults.get(cacheKey); | ||
}; | ||
if (options.method === 'GET') { | ||
const requestIsCacheable = this.isRequestCacheable(request); | ||
if (requestIsCacheable) { | ||
if (request.requestCache) { | ||
@@ -227,0 +232,0 @@ try { |
{ | ||
"name": "apollo-datasource-http", | ||
"version": "0.19.0", | ||
"version": "0.20.0", | ||
"author": "Dustin Deus <deusdustin@gmail.com>", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33927
342