mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-03 09:05:37 +08:00
committed by
Igor Minar
parent
2f45133393
commit
267b217376
@@ -664,6 +664,7 @@ function $HttpProvider() {
|
||||
*/
|
||||
function $http(requestConfig) {
|
||||
var config = {
|
||||
method: 'get',
|
||||
transformRequest: defaults.transformRequest,
|
||||
transformResponse: defaults.transformResponse
|
||||
};
|
||||
|
||||
@@ -405,6 +405,10 @@ describe('$http', function() {
|
||||
$http = $h;
|
||||
}]));
|
||||
|
||||
it('should send GET requests if no method specified', inject(function($httpBackend, $http) {
|
||||
$httpBackend.expect('GET', '/url').respond('');
|
||||
$http({url: '/url'});
|
||||
}));
|
||||
|
||||
it('should do basic request', inject(function($httpBackend, $http) {
|
||||
$httpBackend.expect('GET', '/url').respond('');
|
||||
@@ -1120,6 +1124,16 @@ describe('$http', function() {
|
||||
expect(callback.mostRecentCall.args[0]).toBe('content');
|
||||
}));
|
||||
|
||||
it('should cache request when cache is provided and no method specified', function () {
|
||||
doFirstCacheRequest();
|
||||
|
||||
$http({url: '/url', cache: cache}).success(callback);
|
||||
$rootScope.$digest();
|
||||
|
||||
expect(callback).toHaveBeenCalledOnce();
|
||||
expect(callback.mostRecentCall.args[0]).toBe('content');
|
||||
});
|
||||
|
||||
|
||||
it('should not cache when cache is not provided', function() {
|
||||
doFirstCacheRequest();
|
||||
|
||||
Reference in New Issue
Block a user