File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,14 +5,14 @@ function fetchAsPromise( url: string, options: RequestInit ) {
55 return new Promise ( function ( resolve , reject ) {
66 fetch ( url , options ) . then ( rawResponse => {
77 const contentType = rawResponse . headers . get ( 'content-type' )
8- // const clone = rawResponse.clone()
8+ if ( rawResponse . redirected && contentType && contentType . includes ( 'html' ) ) {
9+ window . location . assign ( rawResponse . url )
10+ return false ;
11+ }
912 let response : any = null
1013 rawResponse . text ( ) . then ( value => {
11- if ( contentType && contentType . indexOf ( 'application/ json' ) ) {
14+ if ( contentType && contentType . includes ( 'json' ) ) {
1215 response = Object . assign ( JSON . parse ( value ) , { _raw : rawResponse } )
13- } else if ( rawResponse . redirected && contentType && contentType . includes ( 'html' ) ) {
14- window . location . assign ( rawResponse . url )
15- return false ;
1616 } else {
1717 response = { data : value , _raw : rawResponse }
1818 }
You can’t perform that action at this time.
0 commit comments