File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -33,14 +33,12 @@ export async function fetch<T>(
33
33
const resp = await fetchRaw ( url , init ) ;
34
34
const contentType = resp . headers . get ( "content-type" ) || "" ;
35
35
36
- if ( resp . ok ) {
37
- // Parse the response as JSON if the content type is JSON
38
- if ( contentType . includes ( "application/json" ) ) {
39
- data = await resp . json ( ) ;
40
- } else {
41
- // Otherwise, return however the response was read
42
- data = ( await resp . text ( ) ) as unknown as T ;
43
- }
36
+ // Parse the response as JSON if the content type is JSON
37
+ if ( contentType . includes ( "application/json" ) ) {
38
+ data = await resp . json ( ) ;
39
+ } else {
40
+ // Otherwise, return however the response was read
41
+ data = ( await resp . text ( ) ) as unknown as T ;
44
42
}
45
43
46
44
return {
You can’t perform that action at this time.
0 commit comments