File tree Expand file tree Collapse file tree 2 files changed +2
-6
lines changed
Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -119,10 +119,6 @@ export default (function create(defaults) {
119119 return overrides ;
120120 }
121121
122- function isOk ( status ) {
123- return ( status / 100 | 0 ) === 2 ;
124- }
125-
126122 /**
127123 * Issues a request.
128124 * @public
@@ -181,7 +177,7 @@ export default (function create(defaults) {
181177 for ( i in res ) {
182178 if ( typeof res [ i ] != 'function' ) response [ i ] = res [ i ] ;
183179 }
184- if ( ! ( options . validateStatus || isOk ) ( res . status ) ) {
180+ if ( ! ( options . validateStatus ? options . validateStatus ( res . status ) : res . ok ) ) {
185181 return Promise . reject ( res ) ;
186182 }
187183 const withData = options . responseType === 'stream'
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ describe('redaxios', () => {
5353 it ( 'should issue POST requests' , async ( ) => {
5454 const oldFetch = window . fetch ;
5555 try {
56- window . fetch = jasmine . createSpy ( 'fetch' ) . and . returnValue ( Promise . resolve ( { status : 200 , text : ( ) => Promise . resolve ( 'yep' ) } ) ) ;
56+ window . fetch = jasmine . createSpy ( 'fetch' ) . and . returnValue ( Promise . resolve ( { ok : true , status : 200 , text : ( ) => Promise . resolve ( 'yep' ) } ) ) ;
5757 const req = axios . post ( '/foo' , {
5858 hello : 'world'
5959 } ) ;
You can’t perform that action at this time.
0 commit comments