route-cache
Advanced tools
Comparing version 0.2.6 to 0.2.7
14
index.js
@@ -42,5 +42,15 @@ 'use strict'; | ||
function rawSend(data, isJson) { | ||
didHandle = true; | ||
var key = req.originalUrl; | ||
// pass-through for Buffer - not supported | ||
if (typeof data === 'object') { | ||
if (Buffer.isBuffer(data)) { | ||
queues[key]=[]; // clear queue | ||
res.set('Content-Length', data.length); | ||
res.original_send(data); | ||
return; | ||
} | ||
} | ||
didHandle = true; | ||
var body = data instanceof Buffer ? data.toString() : data; | ||
@@ -52,3 +62,3 @@ if (res.statusCode < 400) cacheStore.put(key, { body: body, isJson: isJson }, ttl); | ||
var subscriber = null; | ||
while (subscriber === queues[key].shift()) { | ||
while (subscriber = queues[key].shift()) { | ||
if (subscriber) { | ||
@@ -55,0 +65,0 @@ process.nextTick(subscriber); |
{ | ||
"name": "route-cache", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "express middleware for caching your routes", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12978
8
317