diff options
| author | Vojta Jina | 2012-08-04 12:11:00 -0700 | 
|---|---|---|
| committer | Igor Minar | 2012-08-10 16:17:59 -0700 | 
| commit | e0a54f6b206dc2b6595f2bc3a17c5932e7477545 (patch) | |
| tree | 4db991fbffe6258f52e59a47039f0aea8fab3341 /src/ng/httpBackend.js | |
| parent | 9767f7bdd3e1ce6f65bdea992d67369ead13d813 (diff) | |
| download | angular.js-e0a54f6b206dc2b6595f2bc3a17c5932e7477545.tar.bz2 | |
feat($http): support reponseType
Closes #1013
Diffstat (limited to 'src/ng/httpBackend.js')
| -rw-r--r-- | src/ng/httpBackend.js | 10 | 
1 files changed, 7 insertions, 3 deletions
| diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index 0a12aa23..bca46ee1 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -32,7 +32,7 @@ function $HttpBackendProvider() {  function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, locationProtocol) {    // TODO(vojta): fix the signature -  return function(method, url, post, callback, headers, timeout, withCredentials) { +  return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {      $browser.$$incOutstandingRequestCount();      url = url || $browser.url(); @@ -65,8 +65,8 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument,        // always async        xhr.onreadystatechange = function() {          if (xhr.readyState == 4) { -          completeRequest( -              callback, status || xhr.status, xhr.responseText, xhr.getAllResponseHeaders()); +          completeRequest(callback, status || xhr.status, xhr.response || xhr.responseText, +                          xhr.getAllResponseHeaders());          }        }; @@ -74,6 +74,10 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument,          xhr.withCredentials = true;        } +      if (responseType) { +        xhr.responseType = responseType; +      } +        xhr.send(post || '');        if (timeout > 0) { | 
