aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisko Hevery2011-03-09 21:19:19 -0800
committerMisko Hevery2011-03-11 14:16:52 -0800
commitd19c0ac6d32319200f0d94df9b07f63a39aecf70 (patch)
treeed5744dbe753f3d69ef3e935528697b87536932a
parent5343deb3da0e667599fe66d8efa3566b4e337a24 (diff)
downloadangular.js-d19c0ac6d32319200f0d94df9b07f63a39aecf70.tar.bz2
Changed the $browser.xhr parameter post from optional to required
-rw-r--r--CHANGELOG.md5
-rw-r--r--src/Browser.js6
-rw-r--r--test/BrowserSpecs.js4
3 files changed, 7 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 176a0d93..ab711085 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,10 @@
- Fixed cookies which contained unescaped '=' would not show up in cookie service.
- Consider all 2xx responses as OK, not just 200
-
+### Breaking changes
+- Changed the $browser.xhr parameter post from optional to required. Since everyone should be
+ using the $xhr instead of $browser.xhr, this should not break anyone. If you do use $browser.xhr
+ then just add null for the post value argument.
<a name="0.9.12"><a/>
diff --git a/src/Browser.js b/src/Browser.js
index 446944eb..fe6220ed 100644
--- a/src/Browser.js
+++ b/src/Browser.js
@@ -70,17 +70,13 @@ function Browser(window, document, body, XHR, $log) {
*
* @param {string} method Requested method (get|post|put|delete|head|json)
* @param {string} url Requested url
- * @param {string=} post Post data to send
+ * @param {?string} post Post data to send (null if nothing to post)
* @param {function(number, string)} callback Function that will be called on response
*
* @description
* Send ajax request
*/
self.xhr = function(method, url, post, callback) {
- if (isFunction(post)) {
- callback = post;
- post = _null;
- }
outstandingRequestCount ++;
if (lowercase(method) == 'json') {
var callbackId = "angular_" + Math.random() + '_' + (idCounter++);
diff --git a/test/BrowserSpecs.js b/test/BrowserSpecs.js
index c4f49d37..180a7fa8 100644
--- a/test/BrowserSpecs.js
+++ b/test/BrowserSpecs.js
@@ -55,7 +55,7 @@ describe('browser', function(){
it('should queue callbacks with outstanding requests', function(){
var callback = jasmine.createSpy('callback');
- browser.xhr('GET', '/url', noop);
+ browser.xhr('GET', '/url', null, noop);
browser.notifyWhenNoOutstandingRequests(callback);
expect(callback).not.wasCalled();
@@ -70,7 +70,7 @@ describe('browser', function(){
it('should add script tag for request', function() {
var callback = jasmine.createSpy('callback');
var log = "";
- browser.xhr('JSON', 'http://example.org/path?cb=JSON_CALLBACK', function(code, data){
+ browser.xhr('JSON', 'http://example.org/path?cb=JSON_CALLBACK', null, function(code, data){
log += code + ':' + data + ';';
});
browser.notifyWhenNoOutstandingRequests(callback);