This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +9
-2
lines changed
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']).
706
706
707
707
promise . finally ( function ( ) {
708
708
value . $resolved = true ;
709
- if ( cancellable ) {
709
+ if ( ! isInstanceCall && cancellable ) {
710
710
value . $cancelRequest = angular . noop ;
711
711
timeoutDeferred = httpConfig . timeout = null ;
712
712
}
Original file line number Diff line number Diff line change @@ -1428,6 +1428,8 @@ describe('cancelling requests', function() {
1428
1428
) ;
1429
1429
1430
1430
it ( 'should not create a `$cancelRequest` method for instance calls' , function ( ) {
1431
+ $httpBackend . whenPOST ( '/CreditCard' ) . respond ( { } ) ;
1432
+
1431
1433
var CreditCard = $resource ( '/CreditCard' , { } , {
1432
1434
save1 : {
1433
1435
method : 'POST' ,
@@ -1448,6 +1450,11 @@ describe('cancelling requests', function() {
1448
1450
var promise2 = creditCard . $save2 ( ) ;
1449
1451
expect ( promise2 . $cancelRequest ) . toBeUndefined ( ) ;
1450
1452
expect ( creditCard . $cancelRequest ) . toBeUndefined ( ) ;
1453
+
1454
+ $httpBackend . flush ( ) ;
1455
+ expect ( promise1 . $cancelRequest ) . toBeUndefined ( ) ;
1456
+ expect ( promise2 . $cancelRequest ) . toBeUndefined ( ) ;
1457
+ expect ( creditCard . $cancelRequest ) . toBeUndefined ( ) ;
1451
1458
} ) ;
1452
1459
1453
1460
it ( 'should not create a `$cancelRequest` method for non-cancellable calls' , function ( ) {
@@ -1546,7 +1553,7 @@ describe('cancelling requests', function() {
1546
1553
} ) ;
1547
1554
} ) ;
1548
1555
1549
- describe ( 'resource wrt configuring `cancellable` on the provider' , function ( ) {
1556
+ describe ( 'configuring `cancellable` on the provider' , function ( ) {
1550
1557
var $resource ;
1551
1558
1552
1559
beforeEach ( module ( 'ngResource' , function ( $resourceProvider ) {
You can’t perform that action at this time.
0 commit comments