Skip to content

Commit 20bdd19

Browse files
author
dustin deus
committed
fix cache order
1 parent 999876e commit 20bdd19

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/http-data-source.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,15 @@ export abstract class HTTPDataSource<TContext = any> extends DataSource {
301301
cachedResponse.isFromCache = false
302302
return cachedResponse
303303
}
304+
}
305+
306+
const options = {
307+
...this.globalRequestOptions,
308+
...request,
309+
}
304310

311+
// let's see if we can fill the memoized cache
312+
if (options.method === 'GET') {
305313
// try to fetch from shared cache
306314
if (request.requestCache) {
307315
const cacheItem = await this.cache.get(cacheKey)
@@ -312,15 +320,7 @@ export abstract class HTTPDataSource<TContext = any> extends DataSource {
312320
return cachedResponse
313321
}
314322
}
315-
}
316-
317-
const options = {
318-
...this.globalRequestOptions,
319-
...request,
320-
}
321323

322-
// let's see if we can fill the memoized cache
323-
if (options.method === 'GET') {
324324
const response = await this.performRequest<TResult>(options, cacheKey)
325325

326326
if (this.isResponseCacheable<TResult>(options, response)) {

0 commit comments

Comments
 (0)