mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-23 21:35:47 +00:00
Changed the $browser.xhr parameter post from optional to required
This commit is contained in:
parent
5343deb3da
commit
d19c0ac6d3
3 changed files with 7 additions and 8 deletions
|
|
@ -5,7 +5,10 @@
|
||||||
- Fixed cookies which contained unescaped '=' would not show up in cookie service.
|
- Fixed cookies which contained unescaped '=' would not show up in cookie service.
|
||||||
- Consider all 2xx responses as OK, not just 200
|
- 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/>
|
<a name="0.9.12"><a/>
|
||||||
|
|
|
||||||
|
|
@ -70,17 +70,13 @@ function Browser(window, document, body, XHR, $log) {
|
||||||
*
|
*
|
||||||
* @param {string} method Requested method (get|post|put|delete|head|json)
|
* @param {string} method Requested method (get|post|put|delete|head|json)
|
||||||
* @param {string} url Requested url
|
* @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
|
* @param {function(number, string)} callback Function that will be called on response
|
||||||
*
|
*
|
||||||
* @description
|
* @description
|
||||||
* Send ajax request
|
* Send ajax request
|
||||||
*/
|
*/
|
||||||
self.xhr = function(method, url, post, callback) {
|
self.xhr = function(method, url, post, callback) {
|
||||||
if (isFunction(post)) {
|
|
||||||
callback = post;
|
|
||||||
post = _null;
|
|
||||||
}
|
|
||||||
outstandingRequestCount ++;
|
outstandingRequestCount ++;
|
||||||
if (lowercase(method) == 'json') {
|
if (lowercase(method) == 'json') {
|
||||||
var callbackId = "angular_" + Math.random() + '_' + (idCounter++);
|
var callbackId = "angular_" + Math.random() + '_' + (idCounter++);
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ describe('browser', function(){
|
||||||
|
|
||||||
it('should queue callbacks with outstanding requests', function(){
|
it('should queue callbacks with outstanding requests', function(){
|
||||||
var callback = jasmine.createSpy('callback');
|
var callback = jasmine.createSpy('callback');
|
||||||
browser.xhr('GET', '/url', noop);
|
browser.xhr('GET', '/url', null, noop);
|
||||||
browser.notifyWhenNoOutstandingRequests(callback);
|
browser.notifyWhenNoOutstandingRequests(callback);
|
||||||
expect(callback).not.wasCalled();
|
expect(callback).not.wasCalled();
|
||||||
|
|
||||||
|
|
@ -70,7 +70,7 @@ describe('browser', function(){
|
||||||
it('should add script tag for request', function() {
|
it('should add script tag for request', function() {
|
||||||
var callback = jasmine.createSpy('callback');
|
var callback = jasmine.createSpy('callback');
|
||||||
var log = "";
|
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 + ';';
|
log += code + ':' + data + ';';
|
||||||
});
|
});
|
||||||
browser.notifyWhenNoOutstandingRequests(callback);
|
browser.notifyWhenNoOutstandingRequests(callback);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue