File tree Expand file tree Collapse file tree 1 file changed +26
-3
lines changed
packages/toolkit/src/query/tests Expand file tree Collapse file tree 1 file changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -292,6 +292,27 @@ describe('fetchBaseQuery', () => {
292
292
expect ( request . headers [ 'content-type' ] ) . toBe ( 'text/html' )
293
293
expect ( request . body ) . toEqual ( data . join ( ',' ) )
294
294
} )
295
+
296
+ it ( 'supports a custom jsonContentType' , async ( ) => {
297
+ const baseQuery = fetchBaseQuery ( {
298
+ baseUrl,
299
+ fetchFn : fetchFn as any ,
300
+ jsonContentType : 'application/vnd.api+json' ,
301
+ } )
302
+
303
+ let request : any
304
+ ; ( { data : request } = await baseQuery (
305
+ {
306
+ url : '/echo' ,
307
+ body : { } ,
308
+ method : 'POST' ,
309
+ } ,
310
+ commonBaseQueryApi ,
311
+ { }
312
+ ) )
313
+
314
+ expect ( request . headers [ 'content-type' ] ) . toBe ( 'application/vnd.api+json' )
315
+ } )
295
316
} )
296
317
297
318
describe ( 'arg.params' , ( ) => {
@@ -408,9 +429,11 @@ describe('fetchBaseQuery', () => {
408
429
baseUrl,
409
430
fetchFn : fetchFn as any ,
410
431
isJsonContentType : ( headers ) =>
411
- [ 'application/vnd.api+json' , 'application/json' , 'application/vnd.hal+json' ] . includes (
412
- headers . get ( 'content-type' ) ?? ''
413
- ) ,
432
+ [
433
+ 'application/vnd.api+json' ,
434
+ 'application/json' ,
435
+ 'application/vnd.hal+json' ,
436
+ ] . includes ( headers . get ( 'content-type' ) ?? '' ) ,
414
437
} )
415
438
416
439
let request : any
You can’t perform that action at this time.
0 commit comments