[Opensrf-commits] r1291 - trunk/src/javascript

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Mar 24 14:30:16 EDT 2008


Author: erickson
Date: 2008-03-24 13:55:08 -0400 (Mon, 24 Mar 2008)
New Revision: 1291

Modified:
   trunk/src/javascript/opensrf_xhr.js
Log:
added ontransporthander support for multipart requests

Modified: trunk/src/javascript/opensrf_xhr.js
===================================================================
--- trunk/src/javascript/opensrf_xhr.js	2008-03-24 17:34:44 UTC (rev 1290)
+++ trunk/src/javascript/opensrf_xhr.js	2008-03-24 17:55:08 UTC (rev 1291)
@@ -56,6 +56,13 @@
             xreq.onload = function(evt) {xhr_req.core_handler();}
             xreq.open('POST', OSRF_HTTP_TRANSLATOR, true);
             xreq.setRequestHeader(OSRF_HTTP_HEADER_MULTIPART, 'true');
+
+            /* multipart requests do not pass the status info to the onload if there 
+               is no new data to load.  Capture the status on the readystate handler */
+            xreq.onreadystatechange = function() {
+                if(xreq.readyState == 4 && xreq.status >= 400)
+                    xhr_req.transport_error_handler();
+            }
         }
     }
 



More information about the opensrf-commits mailing list