This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +10
-10
lines changed
2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -701,19 +701,15 @@ angular.module('ngResource', ['ng']).
701
701
response . resource = value ;
702
702
703
703
return response ;
704
- } , function ( response ) {
705
- ( error || noop ) ( response ) ;
706
- return $q . reject ( response ) ;
707
704
} ) ;
708
705
709
- promise = promise [ 'finally' ] ( function ( response ) {
706
+ promise = promise [ 'finally' ] ( function ( ) {
710
707
value . $resolved = true ;
711
708
if ( ! isInstanceCall && cancellable ) {
712
709
value . $cancelRequest = angular . noop ;
713
710
$timeout . cancel ( numericTimeoutPromise ) ;
714
711
timeoutDeferred = numericTimeoutPromise = httpConfig . timeout = null ;
715
712
}
716
- return response ;
717
713
} ) ;
718
714
719
715
promise = promise . then (
@@ -722,7 +718,13 @@ angular.module('ngResource', ['ng']).
722
718
( success || noop ) ( value , response . headers ) ;
723
719
return value ;
724
720
} ,
725
- responseErrorInterceptor ) ;
721
+ responseErrorInterceptor || error ?
722
+ function ( response ) {
723
+ ( error || noop ) ( response ) ;
724
+ ( responseErrorInterceptor || noop ) ( response ) ;
725
+ return response ;
726
+ }
727
+ : undefined ) ;
726
728
727
729
if ( ! isInstanceCall ) {
728
730
// we are creating instance / collection
Original file line number Diff line number Diff line change @@ -1052,8 +1052,7 @@ describe("basic usage", function() {
1052
1052
it ( 'should call the error callback if provided on non 2xx response' , function ( ) {
1053
1053
$httpBackend . expect ( 'GET' , '/CreditCard/123' ) . respond ( ERROR_CODE , ERROR_RESPONSE ) ;
1054
1054
1055
- var ccs = CreditCard . get ( { id :123 } , callback , errorCB ) ;
1056
- ccs . $promise . then ( noop , noop ) ;
1055
+ CreditCard . get ( { id :123 } , callback , errorCB ) ;
1057
1056
$httpBackend . flush ( ) ;
1058
1057
expect ( errorCB ) . toHaveBeenCalledOnce ( ) ;
1059
1058
expect ( callback ) . not . toHaveBeenCalled ( ) ;
@@ -1063,8 +1062,7 @@ describe("basic usage", function() {
1063
1062
it ( 'should call the error callback if provided on non 2xx response (without data)' , function ( ) {
1064
1063
$httpBackend . expect ( 'GET' , '/CreditCard' ) . respond ( ERROR_CODE , ERROR_RESPONSE ) ;
1065
1064
1066
- var ccs = CreditCard . get ( callback , errorCB ) ;
1067
- ccs . $promise . then ( noop , noop ) ;
1065
+ CreditCard . get ( callback , errorCB ) ;
1068
1066
$httpBackend . flush ( ) ;
1069
1067
expect ( errorCB ) . toHaveBeenCalledOnce ( ) ;
1070
1068
expect ( callback ) . not . toHaveBeenCalled ( ) ;
You can’t perform that action at this time.
0 commit comments