r9726 - helma-ng/trunk/modules/helma

[email protected] Tue, 12 May 2009 15:16:06 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090512131606.CB9673D0D6@mia>
Author: hannes
Date: 2009-05-12 15:16:06 +0200 (Tue, 12 May 2009)
New Revision: 9726

Modified:
   helma-ng/trunk/modules/helma/httpserver.js
Log:
Check for existence of forEach function in response object instead of requiring an Array in commitResponse(), and throw an error if it doesn't exist.

Details at http://dev.helma.org/trac/helma/changeset/9726

Modified: helma-ng/trunk/modules/helma/httpserver.js
===================================================================
--- helma-ng/trunk/modules/helma/httpserver.js	2009-05-12 09:51:45 UTC (rev 9725)
+++ helma-ng/trunk/modules/helma/httpserver.js	2009-05-12 13:16:06 UTC (rev 9726)
@@ -141,12 +141,12 @@
     var response = env['jack.servlet_response'];
     if (response.isCommitted())
         return;
-    if (!(result instanceof Array)) {
+    if (!result || typeof result.forEach != "function") {
         // convert helma response to jack response
         if (result && typeof result.close === "function") {
             result = result.close();
         } else {
-            return; // TODO generate error page?
+            throw "Unsupported response object: " + result;
         }
     }
     var [status, headers, body] = result;