This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +9
-8
lines changed
2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -697,18 +697,14 @@ angular.module('ngResource', ['ng']).
697
697
response . resource = value ;
698
698
699
699
return response ;
700
- } , function ( response ) {
701
- ( error || noop ) ( response ) ;
702
- return $q . reject ( response ) ;
703
700
} ) ;
704
701
705
- promise = promise . finally ( function ( response ) {
702
+ promise = promise . finally ( function ( ) {
706
703
value . $resolved = true ;
707
704
if ( ! isInstanceCall && cancellable ) {
708
705
value . $cancelRequest = angular . noop ;
709
706
timeoutDeferred = httpConfig . timeout = null ;
710
707
}
711
- return response ;
712
708
} ) ;
713
709
714
710
promise = promise . then (
@@ -717,7 +713,13 @@ angular.module('ngResource', ['ng']).
717
713
( success || noop ) ( value , response . headers ) ;
718
714
return value ;
719
715
} ,
720
- responseErrorInterceptor ) ;
716
+ responseErrorInterceptor || error ?
717
+ function ( response ) {
718
+ ( error || noop ) ( response ) ;
719
+ ( responseErrorInterceptor || noop ) ( response ) ;
720
+ return response ;
721
+ }
722
+ : undefined ) ;
721
723
722
724
if ( ! isInstanceCall ) {
723
725
// 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 ( ) ;
You can’t perform that action at this time.
0 commit comments