File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -636,6 +636,7 @@ angular.module('ngResource', ['ng']).
636
636
var data = extend ( { } , this ) ;
637
637
delete data . $promise ;
638
638
delete data . $resolved ;
639
+ delete data . $cancelRequest ;
639
640
return data ;
640
641
} ;
641
642
Original file line number Diff line number Diff line change @@ -777,6 +777,24 @@ describe('basic usage', function() {
777
777
expect ( json ) . toEqual ( { id : 123 , number : '9876' , $myProp : 'still here' } ) ;
778
778
} ) ;
779
779
780
+ it ( 'should not include $cancelRequest when resource is toJson\'ed' , function ( ) {
781
+ $httpBackend . whenGET ( '/CreditCard' ) . respond ( { } ) ;
782
+
783
+ var CreditCard = $resource ( '/CreditCard' , { } , {
784
+ get : {
785
+ method : 'GET' ,
786
+ cancellable : true
787
+ }
788
+ } ) ;
789
+
790
+ var card = CreditCard . get ( ) ;
791
+ var json = card . toJSON ( ) ;
792
+
793
+ expect ( card . $cancelRequest ) . toBeDefined ( ) ;
794
+ expect ( json . $cancelRequest ) . toBeUndefined ( ) ;
795
+ } ) ;
796
+
797
+
780
798
describe ( 'promise api' , function ( ) {
781
799
782
800
var $rootScope ;
You can’t perform that action at this time.
0 commit comments