diff --git a/lib/cabinet.js b/lib/cabinet.js index ef00c77..e14b174 100644 --- a/lib/cabinet.js +++ b/lib/cabinet.js @@ -212,7 +212,8 @@ var send = exports.send = function(req, res, next, options, cache, virtuals, wat // // Get cached stats object from file meta cache (if we hit no IO is required) // - metaCache.get(path).then(function(meta){ + metaCache.get(path, !options.cache).then(function(meta){ + // // If the file does not exist we call the next middleware. // @@ -237,7 +238,6 @@ var send = exports.send = function(req, res, next, options, cache, virtuals, wat // non-cached transfer. // if(!sendFromCache(req, res, path)){ - // "hidden" file if (!hidden && '.' == basename(path)[0]) return next(); @@ -357,6 +357,7 @@ var send = exports.send = function(req, res, next, options, cache, virtuals, wat * @api private */ function setResponseHeaders(path, res, stat, etag, contentType){ + res.setHeader('X-Powered-By', 'Cabinet'); if (!res.getHeader('Accept-Ranges')) res.setHeader('Accept-Ranges', 'bytes'); if (!res.getHeader('ETag')) res.setHeader('ETag', etag || getEtag(stat)); if (!res.getHeader('Date')) res.setHeader('Date', new Date().toUTCString()); @@ -368,6 +369,7 @@ var send = exports.send = function(req, res, next, options, cache, virtuals, wat if (!res.getHeader('Content-Type')) { res.setHeader('Content-Type', utils.getContentType(path)); } + } /** @@ -662,9 +664,10 @@ var send = exports.send = function(req, res, next, options, cache, virtuals, wat sendEntry(req, res, entry); }) }else{ - entry = []; - entry.headers = _.clone(res._headers); - entry.data.push(data); + entry = { + headers: _.clone(res._headers), + data: [data] + }; sendEntry(req, res, entry); } });