aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/httpBackend.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/ng/httpBackend.js')
-rw-r--r--src/ng/httpBackend.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js
index bca46ee1..5c967c6b 100644
--- a/src/ng/httpBackend.js
+++ b/src/ng/httpBackend.js
@@ -65,8 +65,30 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument,
// always async
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
+ var responseHeaders = xhr.getAllResponseHeaders();
+
+ // TODO(vojta): remove once Firefox 21 gets released.
+ // begin: workaround to overcome Firefox CORS http response headers bug
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=608735
+ // Firefox already patched in nightly. Should land in Firefox 21.
+
+ // CORS "simple response headers" http://www.w3.org/TR/cors/
+ var value,
+ simpleHeaders = ["Cache-Control", "Content-Language", "Content-Type",
+ "Expires", "Last-Modified", "Pragma"];
+ if (!responseHeaders) {
+ responseHeaders = "";
+ forEach(simpleHeaders, function (header) {
+ var value = xhr.getResponseHeader(header);
+ if (value) {
+ responseHeaders += header + ": " + value + "\n";
+ }
+ });
+ }
+ // end of the workaround.
+
completeRequest(callback, status || xhr.status, xhr.response || xhr.responseText,
- xhr.getAllResponseHeaders());
+ responseHeaders);
}
};