Skip to content

Commit

Permalink
fix(cache): fix agent response override on cache hit
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanebachelier committed Feb 10, 2016
1 parent 644cb09 commit 4822a49
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/read-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ export default function (req) {
}

// override request end callback
req.end((err, res) => {
const callback = req.callback // main callback
req.callback = (err, res) => {

if (err) {
return reject(callback(err, res))
return reject(err, res)
}

resolve(callback(null, res))
})
resolve(res)
}

// hydrate pseudo xhr from cached value
req.xhr = hydrate(value)
Expand Down

0 comments on commit 4822a49

Please sign in to comment.