File tree Expand file tree Collapse file tree 1 file changed +20
-20
lines changed
packages/toolkit/src/query Expand file tree Collapse file tree 1 file changed +20
-20
lines changed Original file line number Diff line number Diff line change @@ -42,26 +42,6 @@ const defaultValidateStatus = (response: Response) =>
42
42
const defaultIsJsonContentType = ( headers : Headers ) =>
43
43
/*applicat*/ / i o n \/ ( v n d \. a p i \+ ) ? j s o n / . test ( headers . get ( 'content-type' ) || '' )
44
44
45
- const handleResponse = async (
46
- response : Response ,
47
- responseHandler : ResponseHandler
48
- ) => {
49
- if ( typeof responseHandler === 'function' ) {
50
- return responseHandler ( response )
51
- }
52
-
53
- if ( responseHandler === 'content-type' ) {
54
- responseHandler = isJsonContentType ( response . headers ) ? 'json' : 'text'
55
- }
56
-
57
- if ( responseHandler === 'json' ) {
58
- const text = await response . text ( )
59
- return text . length ? JSON . parse ( text ) : null
60
- }
61
-
62
- return response . text ( )
63
- }
64
-
65
45
export type FetchBaseQueryError =
66
46
| {
67
47
/**
@@ -345,4 +325,24 @@ export function fetchBaseQuery({
345
325
meta,
346
326
}
347
327
}
328
+
329
+ async function handleResponse (
330
+ response : Response ,
331
+ responseHandler : ResponseHandler
332
+ ) {
333
+ if ( typeof responseHandler === 'function' ) {
334
+ return responseHandler ( response )
335
+ }
336
+
337
+ if ( responseHandler === 'content-type' ) {
338
+ responseHandler = isJsonContentType ( response . headers ) ? 'json' : 'text'
339
+ }
340
+
341
+ if ( responseHandler === 'json' ) {
342
+ const text = await response . text ( )
343
+ return text . length ? JSON . parse ( text ) : null
344
+ }
345
+
346
+ return response . text ( )
347
+ }
348
348
}
You can’t perform that action at this time.
0 commit comments