[Groonga-commit] droonga/express-droonga at 052a22a [master] Return cached data correctly.

Back to archive index

SHIMODA Piro Hiroshi null+****@clear*****
Thu Sep 25 03:31:32 JST 2014


SHIMODA "Piro" Hiroshi	2014-09-25 03:31:32 +0900 (Thu, 25 Sep 2014)

  New Revision: 052a22a65250f712bf025075c4646f7ba03a5e6c
  https://github.com/droonga/express-droonga/commit/052a22a65250f712bf025075c4646f7ba03a5e6c

  Message:
    Return cached data correctly.
    
    The cached data is converted to an array, so we have to convert it to a buffer or a string...

  Modified files:
    lib/middleware/cache/index.js

  Modified: lib/middleware/cache/index.js (+4 -1)
  Mode: 100644 -> 100755
===================================================================
--- lib/middleware/cache/index.js    2014-06-29 05:05:50 +0900 (ecafa1b)
+++ lib/middleware/cache/index.js    2014-09-25 03:31:32 +0900 (afec694)
@@ -56,7 +56,10 @@ function sendCachedResponse(response, cached) {
   });
   response.setHeader('X-Droonga-Cached', 'yes');
   cached.body.forEach(function(chunk) {
-    response.write(chunk.data, chunk.encoding);
+    var data = chunk.data;
+    if (!Buffer.isBuffer(data) && Array.isArray(data))
+      data = new Buffer(chunk.data);
+    response.write(data, chunk.encoding);
   });
   response.end();
 }
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index