From 3dabd92bd17c8a9d36eb19f398b74c04ebaa59bb Mon Sep 17 00:00:00 2001 From: Cefn Hoile Date: Mon, 12 Nov 2018 16:00:50 +0000 Subject: [PATCH] Fix handling of Vary Headers in Redis Backend This should fix the bug documented at https://github.com/gitterHQ/request-http-cache/issues/12 which ensures that all resources without Vary headers cannot be cached at all by the Redis backend. --- lib/redis-backend.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/redis-backend.js b/lib/redis-backend.js index 1a170a8..dc48d6d 100644 --- a/lib/redis-backend.js +++ b/lib/redis-backend.js @@ -17,8 +17,8 @@ var JSONBSerializer = require('./jsonb-serializer'); var NullCompressor = require('./null-compressor'); function bufferToString(buffer) { - if (!buffer) return null; if (typeof buffer === 'string') return buffer; + if (!buffer) return null; return buffer.toString('utf8'); }