This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +14
-9
lines changed
2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -568,10 +568,17 @@ angular.module('ngResource', ['ng']).
568
568
undefined ;
569
569
570
570
forEach ( action , function ( value , key ) {
571
- if ( key != 'params' && key != 'isArray' && key != 'interceptor' && key != 'timeout' ) {
572
- httpConfig [ key ] = copy ( value ) ;
573
- } else if ( key == 'timeout' ) {
574
- httpConfig [ key ] = value ;
571
+ switch ( key ) {
572
+ default :
573
+ httpConfig [ key ] = copy ( value ) ;
574
+ break ;
575
+ case 'params' :
576
+ case 'isArray' :
577
+ case 'interceptor' :
578
+ break ;
579
+ case 'timeout' :
580
+ httpConfig [ key ] = value ;
581
+ break ;
575
582
}
576
583
} ) ;
577
584
Original file line number Diff line number Diff line change @@ -1357,7 +1357,7 @@ describe('resource', function() {
1357
1357
) ;
1358
1358
} ) ;
1359
1359
1360
- it ( 'If timeout promise is resolved, cancel the request ' , function ( ) {
1360
+ it ( 'should cancel the request if timeout promise is resolved' , function ( ) {
1361
1361
var canceler = $q . defer ( ) ;
1362
1362
1363
1363
$httpBackend . when ( 'GET' , '/CreditCard' ) . respond ( { data : '123' } ) ;
@@ -1372,7 +1372,7 @@ describe('resource', function() {
1372
1372
CreditCard . query ( ) ;
1373
1373
1374
1374
canceler . resolve ( ) ;
1375
- expect ( function ( ) { $httpBackend . flush ( ) ; } ) . toThrow ( new Error ( "No pending request to flush !" ) ) ;
1375
+ expect ( $httpBackend . flush ) . toThrow ( new Error ( "No pending request to flush !" ) ) ;
1376
1376
1377
1377
canceler = $q . defer ( ) ;
1378
1378
CreditCard = $resource ( '/CreditCard' , { } , {
@@ -1383,9 +1383,7 @@ describe('resource', function() {
1383
1383
} ) ;
1384
1384
1385
1385
CreditCard . query ( ) ;
1386
- expect ( function ( ) { $httpBackend . flush ( ) ; } ) . not . toThrow ( new Error ( "No pending request to flush !" ) ) ;
1387
-
1388
-
1386
+ expect ( $httpBackend . flush ) . not . toThrow ( ) ;
1389
1387
} ) ;
1390
1388
1391
1389
You can’t perform that action at this time.
0 commit comments