@@ -56,6 +56,7 @@ export class ApiEndpoints {
56
56
url : url ,
57
57
method : "delete" ,
58
58
headers : headers ,
59
+ responseType : "arraybuffer" ,
59
60
...config ,
60
61
} ) ;
61
62
@@ -70,12 +71,13 @@ export class ApiEndpoints {
70
71
contentType : contentType ,
71
72
rawResponse : httpRes ,
72
73
} ) ;
74
+ const decodedRes = new TextDecoder ( ) . decode ( httpRes ?. data ) ;
73
75
switch ( true ) {
74
76
case httpRes ?. status == 200 :
75
77
break ;
76
78
default :
77
79
if ( utils . matchContentType ( contentType , `application/json` ) ) {
78
- res . error = utils . objectToClass ( httpRes ?. data , shared . ErrorT ) ;
80
+ res . error = utils . objectToClass ( JSON . parse ( decodedRes ) , shared . ErrorT ) ;
79
81
}
80
82
break ;
81
83
}
@@ -122,6 +124,7 @@ export class ApiEndpoints {
122
124
url : url ,
123
125
method : "get" ,
124
126
headers : headers ,
127
+ responseType : "arraybuffer" ,
125
128
...config ,
126
129
} ) ;
127
130
@@ -136,15 +139,19 @@ export class ApiEndpoints {
136
139
contentType : contentType ,
137
140
rawResponse : httpRes ,
138
141
} ) ;
142
+ const decodedRes = new TextDecoder ( ) . decode ( httpRes ?. data ) ;
139
143
switch ( true ) {
140
144
case httpRes ?. status == 200 :
141
145
if ( utils . matchContentType ( contentType , `application/json` ) ) {
142
- res . apiEndpoint = utils . objectToClass ( httpRes ?. data , shared . ApiEndpoint ) ;
146
+ res . apiEndpoint = utils . objectToClass (
147
+ JSON . parse ( decodedRes ) ,
148
+ shared . ApiEndpoint
149
+ ) ;
143
150
}
144
151
break ;
145
152
default :
146
153
if ( utils . matchContentType ( contentType , `application/json` ) ) {
147
- res . error = utils . objectToClass ( httpRes ?. data , shared . ErrorT ) ;
154
+ res . error = utils . objectToClass ( JSON . parse ( decodedRes ) , shared . ErrorT ) ;
148
155
}
149
156
break ;
150
157
}
@@ -191,6 +198,7 @@ export class ApiEndpoints {
191
198
url : url ,
192
199
method : "get" ,
193
200
headers : headers ,
201
+ responseType : "arraybuffer" ,
194
202
...config ,
195
203
} ) ;
196
204
@@ -206,18 +214,19 @@ export class ApiEndpoints {
206
214
contentType : contentType ,
207
215
rawResponse : httpRes ,
208
216
} ) ;
217
+ const decodedRes = new TextDecoder ( ) . decode ( httpRes ?. data ) ;
209
218
switch ( true ) {
210
219
case httpRes ?. status == 200 :
211
220
if ( utils . matchContentType ( contentType , `application/json` ) ) {
212
221
res . generateOpenApiSpecDiff = utils . objectToClass (
213
- httpRes ?. data ,
222
+ JSON . parse ( decodedRes ) ,
214
223
shared . GenerateOpenApiSpecDiff
215
224
) ;
216
225
}
217
226
break ;
218
227
default :
219
228
if ( utils . matchContentType ( contentType , `application/json` ) ) {
220
- res . error = utils . objectToClass ( httpRes ?. data , shared . ErrorT ) ;
229
+ res . error = utils . objectToClass ( JSON . parse ( decodedRes ) , shared . ErrorT ) ;
221
230
}
222
231
break ;
223
232
}
@@ -263,6 +272,7 @@ export class ApiEndpoints {
263
272
url : url ,
264
273
method : "get" ,
265
274
headers : headers ,
275
+ responseType : "arraybuffer" ,
266
276
...config ,
267
277
} ) ;
268
278
@@ -278,18 +288,16 @@ export class ApiEndpoints {
278
288
contentType : contentType ,
279
289
rawResponse : httpRes ,
280
290
} ) ;
291
+ const decodedRes = new TextDecoder ( ) . decode ( httpRes ?. data ) ;
281
292
switch ( true ) {
282
293
case httpRes ?. status == 200 :
283
294
if ( utils . matchContentType ( contentType , `application/octet-stream` ) ) {
284
- const resBody : string = JSON . stringify ( httpRes ?. data , null , 0 ) ;
285
- const out : Uint8Array = new Uint8Array ( resBody . length ) ;
286
- for ( let i = 0 ; i < resBody . length ; i ++ ) out [ i ] = resBody . charCodeAt ( i ) ;
287
- res . postmanCollection = out ;
295
+ res . postmanCollection = httpRes ?. data ;
288
296
}
289
297
break ;
290
298
default :
291
299
if ( utils . matchContentType ( contentType , `application/json` ) ) {
292
- res . error = utils . objectToClass ( httpRes ?. data , shared . ErrorT ) ;
300
+ res . error = utils . objectToClass ( JSON . parse ( decodedRes ) , shared . ErrorT ) ;
293
301
}
294
302
break ;
295
303
}
@@ -328,6 +336,7 @@ export class ApiEndpoints {
328
336
url : url ,
329
337
method : "get" ,
330
338
headers : headers ,
339
+ responseType : "arraybuffer" ,
331
340
...config ,
332
341
} ) ;
333
342
@@ -343,21 +352,22 @@ export class ApiEndpoints {
343
352
contentType : contentType ,
344
353
rawResponse : httpRes ,
345
354
} ) ;
355
+ const decodedRes = new TextDecoder ( ) . decode ( httpRes ?. data ) ;
346
356
switch ( true ) {
347
357
case httpRes ?. status == 200 :
348
358
if ( utils . matchContentType ( contentType , `application/json` ) ) {
349
359
res . apiEndpoints = [ ] ;
350
360
const resFieldDepth : number = utils . getResFieldDepth ( res ) ;
351
361
res . apiEndpoints = utils . objectToClass (
352
- httpRes ?. data ,
362
+ JSON . parse ( decodedRes ) ,
353
363
shared . ApiEndpoint ,
354
364
resFieldDepth
355
365
) ;
356
366
}
357
367
break ;
358
368
default :
359
369
if ( utils . matchContentType ( contentType , `application/json` ) ) {
360
- res . error = utils . objectToClass ( httpRes ?. data , shared . ErrorT ) ;
370
+ res . error = utils . objectToClass ( JSON . parse ( decodedRes ) , shared . ErrorT ) ;
361
371
}
362
372
break ;
363
373
}
@@ -400,6 +410,7 @@ export class ApiEndpoints {
400
410
url : url ,
401
411
method : "get" ,
402
412
headers : headers ,
413
+ responseType : "arraybuffer" ,
403
414
...config ,
404
415
} ) ;
405
416
@@ -415,21 +426,22 @@ export class ApiEndpoints {
415
426
contentType : contentType ,
416
427
rawResponse : httpRes ,
417
428
} ) ;
429
+ const decodedRes = new TextDecoder ( ) . decode ( httpRes ?. data ) ;
418
430
switch ( true ) {
419
431
case httpRes ?. status == 200 :
420
432
if ( utils . matchContentType ( contentType , `application/json` ) ) {
421
433
res . apiEndpoints = [ ] ;
422
434
const resFieldDepth : number = utils . getResFieldDepth ( res ) ;
423
435
res . apiEndpoints = utils . objectToClass (
424
- httpRes ?. data ,
436
+ JSON . parse ( decodedRes ) ,
425
437
shared . ApiEndpoint ,
426
438
resFieldDepth
427
439
) ;
428
440
}
429
441
break ;
430
442
default :
431
443
if ( utils . matchContentType ( contentType , `application/json` ) ) {
432
- res . error = utils . objectToClass ( httpRes ?. data , shared . ErrorT ) ;
444
+ res . error = utils . objectToClass ( JSON . parse ( decodedRes ) , shared . ErrorT ) ;
433
445
}
434
446
break ;
435
447
}
@@ -472,6 +484,7 @@ export class ApiEndpoints {
472
484
url : url ,
473
485
method : "get" ,
474
486
headers : headers ,
487
+ responseType : "arraybuffer" ,
475
488
...config ,
476
489
} ) ;
477
490
@@ -486,15 +499,19 @@ export class ApiEndpoints {
486
499
contentType : contentType ,
487
500
rawResponse : httpRes ,
488
501
} ) ;
502
+ const decodedRes = new TextDecoder ( ) . decode ( httpRes ?. data ) ;
489
503
switch ( true ) {
490
504
case httpRes ?. status == 200 :
491
505
if ( utils . matchContentType ( contentType , `application/json` ) ) {
492
- res . apiEndpoint = utils . objectToClass ( httpRes ?. data , shared . ApiEndpoint ) ;
506
+ res . apiEndpoint = utils . objectToClass (
507
+ JSON . parse ( decodedRes ) ,
508
+ shared . ApiEndpoint
509
+ ) ;
493
510
}
494
511
break ;
495
512
default :
496
513
if ( utils . matchContentType ( contentType , `application/json` ) ) {
497
- res . error = utils . objectToClass ( httpRes ?. data , shared . ErrorT ) ;
514
+ res . error = utils . objectToClass ( JSON . parse ( decodedRes ) , shared . ErrorT ) ;
498
515
}
499
516
break ;
500
517
}
@@ -552,6 +569,7 @@ export class ApiEndpoints {
552
569
url : url ,
553
570
method : "put" ,
554
571
headers : headers ,
572
+ responseType : "arraybuffer" ,
555
573
data : reqBody ,
556
574
...config ,
557
575
} ) ;
@@ -567,15 +585,19 @@ export class ApiEndpoints {
567
585
contentType : contentType ,
568
586
rawResponse : httpRes ,
569
587
} ) ;
588
+ const decodedRes = new TextDecoder ( ) . decode ( httpRes ?. data ) ;
570
589
switch ( true ) {
571
590
case httpRes ?. status == 200 :
572
591
if ( utils . matchContentType ( contentType , `application/json` ) ) {
573
- res . apiEndpoint = utils . objectToClass ( httpRes ?. data , shared . ApiEndpoint ) ;
592
+ res . apiEndpoint = utils . objectToClass (
593
+ JSON . parse ( decodedRes ) ,
594
+ shared . ApiEndpoint
595
+ ) ;
574
596
}
575
597
break ;
576
598
default :
577
599
if ( utils . matchContentType ( contentType , `application/json` ) ) {
578
- res . error = utils . objectToClass ( httpRes ?. data , shared . ErrorT ) ;
600
+ res . error = utils . objectToClass ( JSON . parse ( decodedRes ) , shared . ErrorT ) ;
579
601
}
580
602
break ;
581
603
}
0 commit comments