Skip to content

Commit

Permalink
fix: ensure cached result is accesible
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Mar 28, 2019
1 parent 5638088 commit a051945
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ module.exports = ({
const url = urlResolve('http://localhost', req.url)
const key = getKey(url)
const cachedResult = await cache.get(key)
const isHit = !!cachedResult && !hasForce
const isHit = !hasForce && cachedResult !== undefined

const { etag: cachedEtag, ttl = defaultTtl, createdAt = Date.now(), data, ...props } = isHit
? cachedResult
? cachedResult || {}
: await get({ req, res, ...opts })

const etag = cachedEtag || getEtag(data)
Expand Down

0 comments on commit a051945

Please sign in to comment.