File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -706,7 +706,7 @@ angular.module('ngResource', ['ng']).
706706
707707 promise . finally ( function ( ) {
708708 value . $resolved = true ;
709- if ( cancellable ) {
709+ if ( ! isInstanceCall && cancellable ) {
710710 value . $cancelRequest = angular . noop ;
711711 timeoutDeferred = httpConfig . timeout = null ;
712712 }
Original file line number Diff line number Diff line change @@ -1428,6 +1428,8 @@ describe('cancelling requests', function() {
14281428 ) ;
14291429
14301430 it ( 'should not create a `$cancelRequest` method for instance calls' , function ( ) {
1431+ $httpBackend . whenPOST ( '/CreditCard' ) . respond ( { } ) ;
1432+
14311433 var CreditCard = $resource ( '/CreditCard' , { } , {
14321434 save1 : {
14331435 method : 'POST' ,
@@ -1448,6 +1450,11 @@ describe('cancelling requests', function() {
14481450 var promise2 = creditCard . $save2 ( ) ;
14491451 expect ( promise2 . $cancelRequest ) . toBeUndefined ( ) ;
14501452 expect ( creditCard . $cancelRequest ) . toBeUndefined ( ) ;
1453+
1454+ $httpBackend . flush ( ) ;
1455+ expect ( promise1 . $cancelRequest ) . toBeUndefined ( ) ;
1456+ expect ( promise2 . $cancelRequest ) . toBeUndefined ( ) ;
1457+ expect ( creditCard . $cancelRequest ) . toBeUndefined ( ) ;
14511458 } ) ;
14521459
14531460 it ( 'should not create a `$cancelRequest` method for non-cancellable calls' , function ( ) {
@@ -1546,7 +1553,7 @@ describe('cancelling requests', function() {
15461553 } ) ;
15471554} ) ;
15481555
1549- describe ( 'resource wrt configuring `cancellable` on the provider' , function ( ) {
1556+ describe ( 'configuring `cancellable` on the provider' , function ( ) {
15501557 var $resource ;
15511558
15521559 beforeEach ( module ( 'ngResource' , function ( $resourceProvider ) {
You can’t perform that action at this time.
0 commit comments