This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -664,6 +664,7 @@ function $HttpProvider() {
664664 */
665665 function $http ( requestConfig ) {
666666 var config = {
667+ method : 'get' ,
667668 transformRequest : defaults . transformRequest ,
668669 transformResponse : defaults . transformResponse
669670 } ;
Original file line number Diff line number Diff line change @@ -405,6 +405,10 @@ describe('$http', function() {
405405 $http = $h ;
406406 } ] ) ) ;
407407
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+ } ) ) ;
408412
409413 it ( 'should do basic request' , inject ( function ( $httpBackend , $http ) {
410414 $httpBackend . expect ( 'GET' , '/url' ) . respond ( '' ) ;
@@ -1120,6 +1124,16 @@ describe('$http', function() {
11201124 expect ( callback . mostRecentCall . args [ 0 ] ) . toBe ( 'content' ) ;
11211125 } ) ) ;
11221126
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+
11231137
11241138 it ( 'should not cache when cache is not provided' , function ( ) {
11251139 doFirstCacheRequest ( ) ;
You can’t perform that action at this time.
0 commit comments