This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -664,6 +664,7 @@ function $HttpProvider() {
664
664
*/
665
665
function $http ( requestConfig ) {
666
666
var config = {
667
+ method : 'get' ,
667
668
transformRequest : defaults . transformRequest ,
668
669
transformResponse : defaults . transformResponse
669
670
} ;
Original file line number Diff line number Diff line change @@ -405,6 +405,10 @@ describe('$http', function() {
405
405
$http = $h ;
406
406
} ] ) ) ;
407
407
408
+ it ( 'should send GET requests if no method specified' , inject ( function ( $httpBackend , $http ) {
409
+ $httpBackend . expect ( 'GET' , '/url' ) . respond ( '' ) ;
410
+ $http ( { url : '/url' } ) ;
411
+ } ) ) ;
408
412
409
413
it ( 'should do basic request' , inject ( function ( $httpBackend , $http ) {
410
414
$httpBackend . expect ( 'GET' , '/url' ) . respond ( '' ) ;
@@ -1120,6 +1124,16 @@ describe('$http', function() {
1120
1124
expect ( callback . mostRecentCall . args [ 0 ] ) . toBe ( 'content' ) ;
1121
1125
} ) ) ;
1122
1126
1127
+ it ( 'should cache request when cache is provided and no method specified' , function ( ) {
1128
+ doFirstCacheRequest ( ) ;
1129
+
1130
+ $http ( { url : '/url' , cache : cache } ) . success ( callback ) ;
1131
+ $rootScope . $digest ( ) ;
1132
+
1133
+ expect ( callback ) . toHaveBeenCalledOnce ( ) ;
1134
+ expect ( callback . mostRecentCall . args [ 0 ] ) . toBe ( 'content' ) ;
1135
+ } ) ;
1136
+
1123
1137
1124
1138
it ( 'should not cache when cache is not provided' , function ( ) {
1125
1139
doFirstCacheRequest ( ) ;
You can’t perform that action at this time.
0 commit comments