added ontransporthander support for multipart requests
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 24 Mar 2008 17:55:08 +0000 (17:55 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 24 Mar 2008 17:55:08 +0000 (17:55 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1291 9efc2488-bf62-4759-914b-345cdb29e865

src/javascript/opensrf_xhr.js

index 81d7e3d..8c79441 100644 (file)
@@ -56,6 +56,13 @@ OpenSRF.XHRequest.prototype.send = function() {
             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();
+            }
         }
     }