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

Update httpBackend, check window.XMLHttpRequest #5679

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/ng/httpBackend.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
'use strict';

function createXhr(method) {
// IE8 doesn't support PATCH method, but the ActiveX object does
/* global ActiveXObject */
return (msie <= 8 && lowercase(method) === 'patch')
? new ActiveXObject('Microsoft.XMLHTTP')
: new window.XMLHttpRequest();
}
//if IE and the method is not RFC2616 compliant, or if XMLHttpRequest
//is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest
//if it is available
if ((window.ActiveXObject && !method.match(/^(get|post|head|put|delete|options)$/i))
|| !window.XMLHttpRequest) {

return new ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
return new window.XMLHttpRequest();
}

throw $httpMinErr('noxhr', 'This browser does not support XMLHttpRequest.');
}

/**
* @ngdoc object
Expand Down