Skip to content

Commit

Permalink
fix(cache): avoid remove item from cache when using HEAD request
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanebachelier committed May 13, 2016
1 parent 5dc05af commit 4017289
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ function cache (config = {}) {

const uuid = key(req)

// clear cache if method different from GET
if (req.method.toLowerCase() !== 'get') {
// clear cache if method different from GET.
// We should exclude HEAD
const method = req.method.toLowerCase()

if (method !== 'get' || method !== 'head') {
config.store.removeItem(uuid)
return null
}
Expand Down

0 comments on commit 4017289

Please sign in to comment.