[Groonga-commit] groonga/express-kotoumi [master] Check existence of handler factory method before calling of it

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Jan 16 16:28:27 JST 2013


YUKI Hiroshi	2013-01-16 16:28:27 +0900 (Wed, 16 Jan 2013)

  New Revision: 0c6d30279b5089ec4d5cd75bfe6fcb53668f6da6
  https://github.com/groonga/express-kotoumi/commit/0c6d30279b5089ec4d5cd75bfe6fcb53668f6da6

  Log:
    Check existence of handler factory method before calling of it

  Modified files:
    lib/index.js

  Modified: lib/index.js (+8 -2)
===================================================================
--- lib/index.js    2013-01-16 16:27:57 +0900 (9191a0e)
+++ lib/index.js    2013-01-16 16:28:27 +0900 (9243bf9)
@@ -27,8 +27,14 @@ express.application.kotoumi = function(params) {
   }
 
   function createHandler(type) {,
-    return handlersFactory && handlersFactory[type](connection) ||
-             createDefaultHandler(type, connection);
+    return (
+      (
+        handlersFactory &&
+        typeof handlersFactory[type] == 'function' &&
+        handlersFactory[type](connection)
+      ) ||
+      createDefaultHandler(type, connection)
+    );
   }
 
   this.get(prefix + '/status/:target', createHandler('status'));
-------------- next part --------------
HTML����������������������������...
Descargar 



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