diff options
Diffstat (limited to 'src/ng')
| -rw-r--r-- | src/ng/http.js | 6 | ||||
| -rw-r--r-- | src/ng/httpBackend.js | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/ng/http.js b/src/ng/http.js index 9c4dafd4..3942c5c7 100644 --- a/src/ng/http.js +++ b/src/ng/http.js @@ -375,6 +375,9 @@ function $HttpProvider() { * {@link angular.module.ng.$cacheFactory $cacheFactory}, this cache will be used for * caching. * - **timeout** – `{number}` – timeout in milliseconds. + * - **withCredentials** - `{boolean}` - whether to to set the `withCredentials` flag on the + * XHR object. See {@link https://developer.mozilla.org/en/http_access_control#section_5 + * requests with credentials} for more information. * * @returns {HttpPromise} Returns a {@link angular.module.ng.$q promise} object with the * standard `then` method and two http specific methods: `success` and `error`. The `then` @@ -674,7 +677,8 @@ function $HttpProvider() { // if we won't have the response in cache, send the request to the backend if (!cachedResp) { - $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout); + $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout, + config.withCredentials); } return promise; diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index abe1d8f5..b2c14b3f 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -32,7 +32,7 @@ function $HttpBackendProvider() { function createHttpBackend($browser, XHR, $browserDefer, callbacks, body, locationProtocol) { // TODO(vojta): fix the signature - return function(method, url, post, callback, headers, timeout) { + return function(method, url, post, callback, headers, timeout, withCredentials) { $browser.$$incOutstandingRequestCount(); url = url || $browser.url(); @@ -71,6 +71,10 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, body, locati } }; + if (withCredentials) { + xhr.withCredentials = true; + } + xhr.send(post || ''); if (timeout > 0) { |
