@@ -100,7 +100,8 @@ const { formatDataPath, checkIsCorrectType, isKnownType } = require('./common/sc
100
100
{ compareVersion } = require ( './common/versionUtils.js' ) ,
101
101
parse = require ( './parse' ) ,
102
102
{ getBundleContentAndComponents, parseFileOrThrow } = require ( './bundle.js' ) ,
103
- MULTI_FILE_API_TYPE_ALLOWED_VALUE = 'multiFile' ;
103
+ MULTI_FILE_API_TYPE_ALLOWED_VALUE = 'multiFile' ,
104
+ MEDIA_TYPE_ALL_RANGES = '*/*' ;
104
105
/* eslint-enable */
105
106
106
107
// See https://github.com/json-schema-faker/json-schema-faker/tree/master/docs#available-options
@@ -1375,14 +1376,20 @@ module.exports = {
1375
1376
responseBody = JSON . stringify ( responseBody , null , options . indentCharacter ) ;
1376
1377
}
1377
1378
else if ( typeof responseBody !== 'string' ) {
1378
- if ( ! _ . isObject ( responseBody ) && _ . isFunction ( _ . get ( responseBody , 'toString' ) ) ) {
1379
- responseBody = responseBody . toString ( ) ;
1379
+ if ( cTypeHeader === MEDIA_TYPE_ALL_RANGES ) {
1380
+ if ( ! _ . isObject ( responseBody ) && _ . isFunction ( _ . get ( responseBody , 'toString' ) ) ) {
1381
+ responseBody = responseBody . toString ( ) ;
1382
+ }
1383
+ else {
1384
+ responseBody = JSON . stringify ( responseBody , null , options . indentCharacter ) ;
1385
+ isJsonLike = true ;
1386
+ }
1380
1387
}
1381
1388
else {
1382
- responseBody = JSON . stringify ( responseBody , null , options . indentCharacter ) ;
1383
- isJsonLike = true ;
1389
+ responseBody = '' ;
1384
1390
}
1385
1391
}
1392
+
1386
1393
return {
1387
1394
contentTypeHeader : cTypeHeader ,
1388
1395
responseBody : responseBody ,
0 commit comments