[Groonga-commit] droonga/express-droonga at 4310d75 [master] Don't set undefined value to the options list

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Oct 17 17:59:34 JST 2014


YUKI Hiroshi	2014-10-17 17:59:34 +0900 (Fri, 17 Oct 2014)

  New Revision: 4310d75cc911062015f611f67a70e392dcf2cb8c
  https://github.com/droonga/express-droonga/commit/4310d75cc911062015f611f67a70e392dcf2cb8c

  Message:
    Don't set undefined value to the options list

  Modified files:
    lib/adapter/http.js

  Modified: lib/adapter/http.js (+14 -9)
===================================================================
--- lib/adapter/http.js    2014-10-17 17:16:04 +0900 (d449e14)
+++ lib/adapter/http.js    2014-10-17 17:59:34 +0900 (1445903)
@@ -13,11 +13,13 @@ function createRequestResponseHandler(params) {
   return (function(request, response) {
     logger.debug('adapter.http.createRequestResponseHandler.handle');
 
-    var timeout = definition.timeout || null;
-    var options = {
-      dataset: definition.dataset,
-      timeout: timeout
-    };
+    var options = {};
+    if (typeof definition.dataset != 'undefined')
+      options.dataset = definition.dataset;
+    var timeout = definition.timeout || undefined;
+    if (typeof timeout != 'undefined')
+      options.timeout = timeout;
+
     var callback = function(error, message) {
         logger.debug('adapter.http.createRequestResponseHandler.handle.response');
         if (error) {
@@ -75,10 +77,13 @@ function createGenericHandler(params) {
   return (function(request, response) {
     logger.debug('adapter.http.createGenericHandler.handle');
 
-    var options = {
-      dataset: definition.dataset,
-      timeout: definition.timeout || null
-    };
+    var options = {};
+    if (typeof definition.dataset != 'undefined')
+      options.dataset = definition.dataset;
+    var timeout = definition.timeout || undefined;
+    if (typeof timeout != 'undefined')
+      options.timeout = timeout;
+
     var processRequest = function(error) {
       if (error) {
         var errorBody = {
-------------- next part --------------
HTML����������������������������...
下载 



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