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 +14
-7
lines changed
Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -568,10 +568,17 @@ angular.module('ngResource', ['ng']).
568568 undefined ;
569569
570570 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 ;
575582 }
576583 } ) ;
577584
Original file line number Diff line number Diff line change @@ -1357,7 +1357,7 @@ describe('resource', function() {
13571357 ) ;
13581358 } ) ;
13591359
1360- it ( 'If timeout promise is resolved, cancel the request ' , function ( ) {
1360+ it ( 'should cancel the request if timeout promise is resolved' , function ( ) {
13611361 var canceler = $q . defer ( ) ;
13621362
13631363 $httpBackend . when ( 'GET' , '/CreditCard' ) . respond ( { data : '123' } ) ;
@@ -1372,7 +1372,7 @@ describe('resource', function() {
13721372 CreditCard . query ( ) ;
13731373
13741374 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 !" ) ) ;
13761376
13771377 canceler = $q . defer ( ) ;
13781378 CreditCard = $resource ( '/CreditCard' , { } , {
@@ -1383,7 +1383,7 @@ describe('resource', function() {
13831383 } ) ;
13841384
13851385 CreditCard . query ( ) ;
1386- expect ( function ( ) { $httpBackend . flush ( ) ; } ) . not . toThrow ( new Error ( "No pending request to flush !" ) ) ;
1386+ expect ( $httpBackend . flush ) . not . toThrow ( new Error ( "No pending request to flush !" ) ) ;
13871387
13881388
13891389 } ) ;
You can’t perform that action at this time.
0 commit comments