From 3f4bfeeb30c22b5d0f7bbfbf4fc039b6ec3b79d0 Mon Sep 17 00:00:00 2001 From: Alex Casanova Date: Fri, 6 Jul 2012 07:03:07 -0400 Subject: [PATCH 1/2] added app: protocol to completeRequest method in httpBackend.js --- src/ng/httpBackend.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index 0a12aa23b4a5..1a15ddb053fc 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -91,6 +91,7 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, // fix status code for file protocol (it's always 0) status = (protocol == 'file') ? (response ? 200 : 404) : status; + status = (protocol == 'app') ? (response ? 200 : 404) : status; // normalize IE bug (http://bugs.jquery.com/ticket/1450) status = status == 1223 ? 204 : status; From 63338db1fdde0a55fe5100c72162c6623c1f0467 Mon Sep 17 00:00:00 2001 From: Alex Casanova Date: Sun, 22 Jul 2012 10:29:55 -0400 Subject: [PATCH 2/2] add regexp to allow multiple protocols during completeRequest function --- src/ng/httpBackend.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index 1a15ddb053fc..08d27dfd55a1 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -87,11 +87,11 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, function completeRequest(callback, status, response, headersString) { // URL_MATCH is defined in src/service/location.js - var protocol = (url.match(URL_MATCH) || ['', locationProtocol])[1]; + var protocol = (url.match(URL_MATCH) || ['', locationProtocol])[1], + valid_protocols = /^(app|file)$/; // fix status code for file protocol (it's always 0) - status = (protocol == 'file') ? (response ? 200 : 404) : status; - status = (protocol == 'app') ? (response ? 200 : 404) : status; + status = valid_protocols.test(protocol) ? (response ? 200 : 404) : status; // normalize IE bug (http://bugs.jquery.com/ticket/1450) status = status == 1223 ? 204 : status;