diff options
| author | Igor Minar | 2011-06-29 00:25:13 -0700 | 
|---|---|---|
| committer | Igor Minar | 2011-06-30 00:34:50 -0700 | 
| commit | c5f3a413bc00acf9ac1046fb15b454096a8890c6 (patch) | |
| tree | 9000f1f5f377d5f022aa8e338dfe810dc913d282 /src/Browser.js | |
| parent | d3fb5b411e979d0a4815c663c3489652fc5350f9 (diff) | |
| download | angular.js-c5f3a413bc00acf9ac1046fb15b454096a8890c6.tar.bz2 | |
feat:$xhr: provide access to $xhr header defaults
$xhr header defaults are now exposed as $xhr.defaults.headers.common and
$xhr.default.headers.<httpmethod>. This allows applications to configure
their defaults as needed.
This commit doesn't allow headers to be set per request, only per
application. Per request change would require api change, which I tried
to avoid *for now*.
Diffstat (limited to 'src/Browser.js')
| -rw-r--r-- | src/Browser.js | 11 | 
1 files changed, 1 insertions, 10 deletions
| diff --git a/src/Browser.js b/src/Browser.js index 5a675e3c..37fb4931 100644 --- a/src/Browser.js +++ b/src/Browser.js @@ -8,14 +8,6 @@ var XHR = window.XMLHttpRequest || function () {    throw new Error("This browser does not support XMLHttpRequest.");  }; -// default xhr headers -var XHR_HEADERS = { -  DEFAULT: { -    "Accept": "application/json, text/plain, */*", -    "X-Requested-With": "XMLHttpRequest" -  }, -  POST: {'Content-Type': 'application/x-www-form-urlencoded'} -};  /**   * @private @@ -108,8 +100,7 @@ function Browser(window, document, body, XHR, $log) {      } else {        var xhr = new XHR();        xhr.open(method, url, true); -      forEach(extend({}, XHR_HEADERS.DEFAULT, XHR_HEADERS[uppercase(method)] || {}, headers || {}), -        function(value, key) { +      forEach(headers, function(value, key) {            if (value) xhr.setRequestHeader(key, value);        });        xhr.onreadystatechange = function() { | 
