Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Commit

Permalink
Don't check the cache for ?write=true GETs
Browse files Browse the repository at this point in the history
Kinda defeats the whole purpose otherwise.
  • Loading branch information
isaacs committed Feb 16, 2014
1 parent b5e02cf commit cd22eaa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ function get (uri, timeout, nofollow, staleOk, cb) {
cacheUri = cacheUri.replace(/:/g, '_')
var cache = path.join(this.conf.get('cache'), cacheUri, ".cache.json")

// If the GET is part of a write operation (PUT or DELETE), then
// skip past the cache entirely, but still save the results.
if (uri.match(/\?write=true$/))
return get_.call(this, uri, timeout, cache, null, null, nofollow, staleOk, cb)


fs.stat(cache, function (er, stat) {
if (!er) fs.readFile(cache, function (er, data) {
try { data = JSON.parse(data) }
Expand Down

0 comments on commit cd22eaa

Please sign in to comment.