aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Browser.js4
-rw-r--r--test/BrowserSpecs.js13
2 files changed, 16 insertions, 1 deletions
diff --git a/src/Browser.js b/src/Browser.js
index b10c43cf..31f2c7f3 100644
--- a/src/Browser.js
+++ b/src/Browser.js
@@ -113,7 +113,9 @@ function Browser(window, document, body, XHR, $log) {
});
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
- completeOutstandingRequest(callback, xhr.status || 200, xhr.responseText);
+ // normalize IE bug (http://bugs.jquery.com/ticket/1450)
+ var status = xhr.status == 1223 ? 204 : xhr.status || 200;
+ completeOutstandingRequest(callback, status, xhr.responseText);
}
};
xhr.send(post || '');
diff --git a/test/BrowserSpecs.js b/test/BrowserSpecs.js
index 45fb0ed9..45e5f6be 100644
--- a/test/BrowserSpecs.js
+++ b/test/BrowserSpecs.js
@@ -124,6 +124,19 @@ describe('browser', function(){
expect(response).toEqual('RESPONSE');
});
+ it('should normalize IE\'s 1223 status code into 204', function() {
+ var callback = jasmine.createSpy('XHR');
+
+ browser.xhr('GET', 'URL', 'POST', callback);
+
+ xhr.status = 1223;
+ xhr.readyState = 4;
+ xhr.onreadystatechange();
+
+ expect(callback).toHaveBeenCalled();
+ expect(callback.argsForCall[0][0]).toEqual(204);
+ });
+
it('should not set Content-type header for GET requests', function() {
browser.xhr('GET', 'URL', 'POST-DATA', function(c, r) {});