From 06ca07b5492f0d81b5506c537a24079ed1e4a8c0 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 24 Mar 2008 17:55:08 +0000 Subject: [PATCH] added ontransporthander support for multipart requests git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1291 9efc2488-bf62-4759-914b-345cdb29e865 --- src/javascript/opensrf_xhr.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/javascript/opensrf_xhr.js b/src/javascript/opensrf_xhr.js index 81d7e3d..8c79441 100644 --- a/src/javascript/opensrf_xhr.js +++ b/src/javascript/opensrf_xhr.js @@ -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(); + } } } -- 2.11.0