Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit e2ce50e

Browse files
committed
refactor($http) Simplify code by removing the createXhr() method
This removes a workaround for IE 8 and and error handling for IE6.
1 parent a8fe2cc commit e2ce50e

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/ng/httpBackend.js

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
'use strict';
22

3-
function createXhr(method) {
4-
//if IE and the method is not RFC2616 compliant, or if XMLHttpRequest
5-
//is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest
6-
//if it is available
7-
if (msie <= 8 && (!method.match(/^(get|post|head|put|delete|options)$/i) ||
8-
!window.XMLHttpRequest)) {
9-
return new window.ActiveXObject("Microsoft.XMLHTTP");
10-
} else if (window.XMLHttpRequest) {
11-
return new window.XMLHttpRequest();
12-
}
13-
14-
throw minErr('$httpBackend')('noxhr', "This browser does not support XMLHttpRequest.");
3+
function createXhr() {
4+
return new window.XMLHttpRequest();
155
}
166

177
/**
@@ -59,7 +49,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
5949
});
6050
} else {
6151

62-
var xhr = createXhr(method);
52+
var xhr = createXhr();
6353

6454
xhr.open(method, url, true);
6555
forEach(headers, function(value, key) {

0 commit comments

Comments
 (0)