@@ -68,6 +68,7 @@ export interface MiddlewareContext {
68
68
endpoint : string ;
69
69
request : unknown ;
70
70
response ?: unknown ;
71
+ responseBody ?: string ;
71
72
baseURL : string ;
72
73
headers : { [ key : string ] : string } ;
73
74
options : { [ key : string ] : any } ;
@@ -248,11 +249,14 @@ class ServiceClient {
248
249
}
249
250
) ;
250
251
252
+ const responseText = await resp . text ( ) ;
253
+ context . responseBody = responseText ;
254
+
251
255
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
252
- const responseText = await resp . text ( ) ;
256
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
253
257
throw new ApiError ( resp , responseText ) ;
254
258
}
255
- const res = ( await resp . json ( ) ) as ServiceGetArticleResponse ;
259
+ const res = JSON . parse ( responseText ) as ServiceGetArticleResponse ;
256
260
context . response = res ;
257
261
await this . callMiddleware ( this . afterMiddleware , context ) ;
258
262
return res ;
@@ -396,11 +400,14 @@ class ServiceGroupsClient {
396
400
}
397
401
) ;
398
402
403
+ const responseText = await resp . text ( ) ;
404
+ context . responseBody = responseText ;
405
+
399
406
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
400
- const responseText = await resp . text ( ) ;
407
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
401
408
throw new ApiError ( resp , responseText ) ;
402
409
}
403
- const res = ( await resp . json ( ) ) as ServiceGroupsGetGroupsResponse ;
410
+ const res = JSON . parse ( responseText ) as ServiceGroupsGetGroupsResponse ;
404
411
context . response = res ;
405
412
await this . callMiddleware ( this . afterMiddleware , context ) ;
406
413
return res ;
@@ -587,11 +594,14 @@ class ServiceStaticPageClient {
587
594
}
588
595
) ;
589
596
597
+ const responseText = await resp . text ( ) ;
598
+ context . responseBody = responseText ;
599
+
590
600
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
591
- const responseText = await resp . text ( ) ;
601
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
592
602
throw new ApiError ( resp , responseText ) ;
593
603
}
594
- const res = ( await resp . json ( ) ) as ServiceStaticPageGetStaticPageResponse ;
604
+ const res = JSON . parse ( responseText ) as ServiceStaticPageGetStaticPageResponse ;
595
605
context . response = res ;
596
606
await this . callMiddleware ( this . afterMiddleware , context ) ;
597
607
return res ;
@@ -788,8 +798,11 @@ class ServiceUser2Client {
788
798
}
789
799
) ;
790
800
801
+ const responseText = await resp . text ( ) ;
802
+ context . responseBody = responseText ;
803
+
791
804
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
792
- const responseText = await resp . text ( ) ;
805
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
793
806
throw new ApiError ( resp , responseText ) ;
794
807
}
795
808
await resp . text ( ) ;
@@ -869,11 +882,14 @@ class ServiceUser2Client {
869
882
}
870
883
) ;
871
884
885
+ const responseText = await resp . text ( ) ;
886
+ context . responseBody = responseText ;
887
+
872
888
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
873
- const responseText = await resp . text ( ) ;
889
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
874
890
throw new ApiError ( resp , responseText ) ;
875
891
}
876
- const res = ( await resp . json ( ) ) as ServiceUser2GetUserResponse ;
892
+ const res = JSON . parse ( responseText ) as ServiceUser2GetUserResponse ;
877
893
context . response = res ;
878
894
await this . callMiddleware ( this . afterMiddleware , context ) ;
879
895
return res ;
@@ -965,11 +981,14 @@ class ServiceUser2Client {
965
981
}
966
982
) ;
967
983
984
+ const responseText = await resp . text ( ) ;
985
+ context . responseBody = responseText ;
986
+
968
987
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
969
- const responseText = await resp . text ( ) ;
988
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
970
989
throw new ApiError ( resp , responseText ) ;
971
990
}
972
- const res = ( await resp . json ( ) ) as ServiceUser2PostUpdateUserNameResponse ;
991
+ const res = JSON . parse ( responseText ) as ServiceUser2PostUpdateUserNameResponse ;
973
992
context . response = res ;
974
993
await this . callMiddleware ( this . afterMiddleware , context ) ;
975
994
return res ;
@@ -1047,11 +1066,14 @@ class ServiceUser2Client {
1047
1066
}
1048
1067
) ;
1049
1068
1069
+ const responseText = await resp . text ( ) ;
1070
+ context . responseBody = responseText ;
1071
+
1050
1072
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
1051
- const responseText = await resp . text ( ) ;
1073
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
1052
1074
throw new ApiError ( resp , responseText ) ;
1053
1075
}
1054
- const res = ( await resp . json ( ) ) as ServiceUser2PostUpdateUserPasswordResponse ;
1076
+ const res = JSON . parse ( responseText ) as ServiceUser2PostUpdateUserPasswordResponse ;
1055
1077
context . response = res ;
1056
1078
await this . callMiddleware ( this . afterMiddleware , context ) ;
1057
1079
return res ;
@@ -1192,11 +1214,14 @@ class ServiceUser2UserIDClient {
1192
1214
}
1193
1215
) ;
1194
1216
1217
+ const responseText = await resp . text ( ) ;
1218
+ context . responseBody = responseText ;
1219
+
1195
1220
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
1196
- const responseText = await resp . text ( ) ;
1221
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
1197
1222
throw new ApiError ( resp , responseText ) ;
1198
1223
}
1199
- const res = ( await resp . json ( ) ) as ServiceUser2UserIDGetUserJobGetResponse ;
1224
+ const res = JSON . parse ( responseText ) as ServiceUser2UserIDGetUserJobGetResponse ;
1200
1225
context . response = res ;
1201
1226
await this . callMiddleware ( this . afterMiddleware , context ) ;
1202
1227
return res ;
@@ -1328,11 +1353,14 @@ class ServiceUser2UserIDJobIDClient {
1328
1353
}
1329
1354
) ;
1330
1355
1356
+ const responseText = await resp . text ( ) ;
1357
+ context . responseBody = responseText ;
1358
+
1331
1359
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
1332
- const responseText = await resp . text ( ) ;
1360
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
1333
1361
throw new ApiError ( resp , responseText ) ;
1334
1362
}
1335
- const res = ( await resp . json ( ) ) as ServiceUser2UserIDJobIDPutJobResponse ;
1363
+ const res = JSON . parse ( responseText ) as ServiceUser2UserIDJobIDPutJobResponse ;
1336
1364
context . response = res ;
1337
1365
await this . callMiddleware ( this . afterMiddleware , context ) ;
1338
1366
return res ;
@@ -1465,8 +1493,11 @@ class ServiceUserClient {
1465
1493
}
1466
1494
) ;
1467
1495
1496
+ const responseText = await resp . text ( ) ;
1497
+ context . responseBody = responseText ;
1498
+
1468
1499
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
1469
- const responseText = await resp . text ( ) ;
1500
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
1470
1501
throw new ApiError ( resp , responseText ) ;
1471
1502
}
1472
1503
await resp . text ( ) ;
@@ -1548,11 +1579,14 @@ class ServiceUserClient {
1548
1579
}
1549
1580
) ;
1550
1581
1582
+ const responseText = await resp . text ( ) ;
1583
+ context . responseBody = responseText ;
1584
+
1551
1585
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
1552
- const responseText = await resp . text ( ) ;
1586
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
1553
1587
throw new ApiError ( resp , responseText ) ;
1554
1588
}
1555
- const res = ( await resp . json ( ) ) as ServiceUserPostUpdateUserNameResponse ;
1589
+ const res = JSON . parse ( responseText ) as ServiceUserPostUpdateUserNameResponse ;
1556
1590
context . response = res ;
1557
1591
await this . callMiddleware ( this . afterMiddleware , context ) ;
1558
1592
return res ;
@@ -1630,11 +1664,14 @@ class ServiceUserClient {
1630
1664
}
1631
1665
) ;
1632
1666
1667
+ const responseText = await resp . text ( ) ;
1668
+ context . responseBody = responseText ;
1669
+
1633
1670
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
1634
- const responseText = await resp . text ( ) ;
1671
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
1635
1672
throw new ApiError ( resp , responseText ) ;
1636
1673
}
1637
- const res = ( await resp . json ( ) ) as ServiceUserPostUpdateUserPasswordResponse ;
1674
+ const res = JSON . parse ( responseText ) as ServiceUserPostUpdateUserPasswordResponse ;
1638
1675
context . response = res ;
1639
1676
await this . callMiddleware ( this . afterMiddleware , context ) ;
1640
1677
return res ;
@@ -1825,11 +1862,14 @@ export class APIClient {
1825
1862
}
1826
1863
) ;
1827
1864
1865
+ const responseText = await resp . text ( ) ;
1866
+ context . responseBody = responseText ;
1867
+
1828
1868
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
1829
- const responseText = await resp . text ( ) ;
1869
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
1830
1870
throw new ApiError ( resp , responseText ) ;
1831
1871
}
1832
- const res = ( await resp . json ( ) ) as GetResponse ;
1872
+ const res = JSON . parse ( responseText ) as GetResponse ;
1833
1873
context . response = res ;
1834
1874
await this . callMiddleware ( this . afterMiddleware , context ) ;
1835
1875
return res ;
@@ -1927,11 +1967,14 @@ export class APIClient {
1927
1967
}
1928
1968
) ;
1929
1969
1970
+ const responseText = await resp . text ( ) ;
1971
+ context . responseBody = responseText ;
1972
+
1930
1973
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
1931
- const responseText = await resp . text ( ) ;
1974
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
1932
1975
throw new ApiError ( resp , responseText ) ;
1933
1976
}
1934
- const res = ( await resp . json ( ) ) as PostCreateTableResponse ;
1977
+ const res = JSON . parse ( responseText ) as PostCreateTableResponse ;
1935
1978
context . response = res ;
1936
1979
await this . callMiddleware ( this . afterMiddleware , context ) ;
1937
1980
return res ;
@@ -2015,11 +2058,14 @@ export class APIClient {
2015
2058
}
2016
2059
) ;
2017
2060
2061
+ const responseText = await resp . text ( ) ;
2062
+ context . responseBody = responseText ;
2063
+
2018
2064
if ( Math . floor ( resp . status / 100 ) !== 2 ) {
2019
- const responseText = await resp . text ( ) ;
2065
+ await this . callMiddleware ( this . afterMiddleware , context ) ;
2020
2066
throw new ApiError ( resp , responseText ) ;
2021
2067
}
2022
- const res = ( await resp . json ( ) ) as PostCreateUserResponse ;
2068
+ const res = JSON . parse ( responseText ) as PostCreateUserResponse ;
2023
2069
context . response = res ;
2024
2070
await this . callMiddleware ( this . afterMiddleware , context ) ;
2025
2071
return res ;
0 commit comments