diff --git a/lib/ExpressRedisCache/route.js b/lib/ExpressRedisCache/route.js index 4491501..3b8e36d 100644 --- a/lib/ExpressRedisCache/route.js +++ b/lib/ExpressRedisCache/route.js @@ -166,7 +166,11 @@ module.exports = (function () { /** if it's cached, display cache **/ if ( cache.length ) { - res.contentType(cache[0].type || "text/html"); + if (res.contentType) { + res.contentType(cache[0].type || "text/html"); + } else if (res.setHeader) { + res.setHeader('content-type', cache[0].type || "text/html"); + } if(binary){ //Convert back to binary buffer res.send(new Buffer(cache[0].body, 'base64')); }else{