@maiyunnet/kebab 9.17.1 → 9.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/doc/kebab-rag.md CHANGED
@@ -1428,7 +1428,7 @@ index/variables/VER.md
1428
1428
 
1429
1429
  # Variable: VER
1430
1430
 
1431
- > `const` **VER**: `"9.17.1"` = `'9.17.1'`
1431
+ > `const` **VER**: `"9.17.2"` = `'9.17.2'`
1432
1432
 
1433
1433
  Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
1434
1434
 
@@ -3418,7 +3418,7 @@ lib/core/functions/clone.md
3418
3418
 
3419
3419
  > **clone**\<`T`\>(`obj`): `T`
3420
3420
 
3421
- Defined in: [lib/core.ts:1354](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1354)
3421
+ Defined in: [lib/core.ts:1409](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1409)
3422
3422
 
3423
3423
  完整的克隆一份数组/对象
3424
3424
 
@@ -3482,7 +3482,7 @@ lib/core/functions/debug.md
3482
3482
 
3483
3483
  > **debug**(`message?`, ...`optionalParams`): `void`
3484
3484
 
3485
- Defined in: [lib/core.ts:1400](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1400)
3485
+ Defined in: [lib/core.ts:1455](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1455)
3486
3486
 
3487
3487
  打印调试信息,线上环境不会打印
3488
3488
 
@@ -3517,7 +3517,7 @@ lib/core/functions/display.md
3517
3517
 
3518
3518
  > **display**(`message?`, ...`optionalParams`): `void`
3519
3519
 
3520
- Defined in: [lib/core.ts:1413](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1413)
3520
+ Defined in: [lib/core.ts:1468](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1468)
3521
3521
 
3522
3522
  向控制台直接显示内容,一般情况下禁止使用
3523
3523
 
@@ -3629,7 +3629,7 @@ lib/core/functions/getLog.md
3629
3629
 
3630
3630
  > **getLog**(`opt`): `Promise`\<`false` \| \{ `list`: `any`[] \| `string`[][]; `total`: `number`; \}\>
3631
3631
 
3632
- Defined in: [lib/core.ts:1266](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1266)
3632
+ Defined in: [lib/core.ts:1321](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1321)
3633
3633
 
3634
3634
  获取日志内容为一个数组
3635
3635
 
@@ -3802,7 +3802,7 @@ lib/core/functions/loadEnv.md
3802
3802
 
3803
3803
  > **loadEnv**(`dir`): `Promise`\<`void`\>
3804
3804
 
3805
- Defined in: [lib/core.ts:1484](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1484)
3805
+ Defined in: [lib/core.ts:1539](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1539)
3806
3806
 
3807
3807
  加载 .env 文件到 process.env,若文件不存在则跳过
3808
3808
 
@@ -3831,7 +3831,7 @@ lib/core/functions/log.md
3831
3831
 
3832
3832
  > **log**(`opt`, `msg`, `fend?`): `void`
3833
3833
 
3834
- Defined in: [lib/core.ts:1153](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1153)
3834
+ Defined in: [lib/core.ts:1208](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1208)
3835
3835
 
3836
3836
  写入文件日志
3837
3837
 
@@ -3872,7 +3872,7 @@ lib/core/functions/ls.md
3872
3872
 
3873
3873
  > **ls**(`opt`): `Promise`\<`object`[]\>
3874
3874
 
3875
- Defined in: [lib/core.ts:1315](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1315)
3875
+ Defined in: [lib/core.ts:1370](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1370)
3876
3876
 
3877
3877
  获取目录内文件/文件夹列表
3878
3878
 
@@ -4242,7 +4242,7 @@ lib/core/functions/removeGlobal.md
4242
4242
 
4243
4243
  > **removeGlobal**(`key`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4244
4244
 
4245
- Defined in: [lib/core.ts:970](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L970)
4245
+ Defined in: [lib/core.ts:1025](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1025)
4246
4246
 
4247
4247
  移除某个跨线程/跨内网服务器全局变量
4248
4248
 
@@ -4277,7 +4277,7 @@ lib/core/functions/resolveEnvVars.md
4277
4277
 
4278
4278
  > **resolveEnvVars**(`obj`): `void`
4279
4279
 
4280
- Defined in: [lib/core.ts:1514](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1514)
4280
+ Defined in: [lib/core.ts:1569](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1569)
4281
4281
 
4282
4282
  将配置对象中的 ${ENV_VAR} 占位符替换为 process.env 的值
4283
4283
 
@@ -4306,7 +4306,7 @@ lib/core/functions/sendNpm.md
4306
4306
 
4307
4307
  > **sendNpm**(`path`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4308
4308
 
4309
- Defined in: [lib/core.ts:869](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L869)
4309
+ Defined in: [lib/core.ts:924](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L924)
4310
4310
 
4311
4311
  向本机或局域网 RPC 发送 npm install 操作
4312
4312
 
@@ -4341,7 +4341,7 @@ lib/core/functions/sendPackage.md
4341
4341
 
4342
4342
  > **sendPackage**(`content`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4343
4343
 
4344
- Defined in: [lib/core.ts:1093](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1093)
4344
+ Defined in: [lib/core.ts:1148](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1148)
4345
4345
 
4346
4346
  向本机或局域网 RPC 发送 package.json 更新操作
4347
4347
 
@@ -4376,7 +4376,7 @@ lib/core/functions/sendPm2.md
4376
4376
 
4377
4377
  > **sendPm2**(`name`, `action?`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4378
4378
 
4379
- Defined in: [lib/core.ts:821](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L821)
4379
+ Defined in: [lib/core.ts:876](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L876)
4380
4380
 
4381
4381
  向本机或局域网 RPC 发送 PM2 操作
4382
4382
 
@@ -4404,6 +4404,8 @@ PM2 操作类型
4404
4404
 
4405
4405
  `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4406
4406
 
4407
+ 各主机是否已接收并排队,不代表 PM2 操作最终执行成功
4408
+
4407
4409
  lib/core/functions/sendProject.md
4408
4410
  ---
4409
4411
 
@@ -4417,7 +4419,7 @@ lib/core/functions/sendProject.md
4417
4419
 
4418
4420
  > **sendProject**(`path`, `key`, `value`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4419
4421
 
4420
- Defined in: [lib/core.ts:1045](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1045)
4422
+ Defined in: [lib/core.ts:1100](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1100)
4421
4423
 
4422
4424
  向本机或局域网 RPC 发送项目配置更新操作
4423
4425
 
@@ -4507,6 +4509,37 @@ Defined in: [lib/core.ts:763](https://github.com/maiyunnet/kebab/blob/master/lib
4507
4509
 
4508
4510
  `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4509
4511
 
4512
+ lib/core/functions/sendStop.md
4513
+ ---
4514
+
4515
+ [**Documents for @maiyunnet/kebab**](../../../index.md)
4516
+
4517
+ ***
4518
+
4519
+ [Documents for @maiyunnet/kebab](../../../index.md) / [lib/core](../index.md) / sendStop
4520
+
4521
+ # Function: sendStop()
4522
+
4523
+ > **sendStop**(`hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4524
+
4525
+ Defined in: [lib/core.ts:817](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L817)
4526
+
4527
+ 向主进程(或局域网同代码机子)发送 stop 操作,停止接收新连接并在现有连接全部结束后退出
4528
+
4529
+ ## Parameters
4530
+
4531
+ ### hosts?
4532
+
4533
+ `string`[] \| `"config"`
4534
+
4535
+ 局域网主机列表,config 表示使用全局配置;不传时通知当前 master
4536
+
4537
+ ## Returns
4538
+
4539
+ `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4540
+
4541
+ 各主机发送结果
4542
+
4510
4543
  lib/core/functions/setCookie.md
4511
4544
  ---
4512
4545
 
@@ -4567,7 +4600,7 @@ lib/core/functions/setGlobal.md
4567
4600
 
4568
4601
  > **setGlobal**(`key`, `data`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4569
4602
 
4570
- Defined in: [lib/core.ts:920](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L920)
4603
+ Defined in: [lib/core.ts:975](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L975)
4571
4604
 
4572
4605
  设置跨线程/指定的局域网主机的全局变量
4573
4606
 
@@ -4666,7 +4699,7 @@ lib/core/functions/updateCode.md
4666
4699
 
4667
4700
  > **updateCode**(`sourcePath`, `path`, `hosts?`, `config?`, `strict?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4668
4701
 
4669
- Defined in: [lib/core.ts:985](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L985)
4702
+ Defined in: [lib/core.ts:1040](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1040)
4670
4703
 
4671
4704
  上传并覆盖代码文件,config.json、kebab.json、.js.map、.ts, .gitignore 不会被覆盖和新创建
4672
4705
 
@@ -4719,7 +4752,7 @@ lib/core/functions/writeEventStreamHead.md
4719
4752
 
4720
4753
  > **writeEventStreamHead**(`res`): `void`
4721
4754
 
4722
- Defined in: [lib/core.ts:1454](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1454)
4755
+ Defined in: [lib/core.ts:1509](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1509)
4723
4756
 
4724
4757
  提交服务器发送事件(SSE)响应头
4725
4758
 
@@ -4754,7 +4787,7 @@ lib/core/functions/writeHead.md
4754
4787
 
4755
4788
  > **writeHead**(`res`, `statusCode`, `headers?`): `void`
4756
4789
 
4757
- Defined in: [lib/core.ts:1433](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1433)
4790
+ Defined in: [lib/core.ts:1488](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1488)
4758
4791
 
4759
4792
  提交 HTTP 响应状态和头部,兼容 HTTP/1.1 与 HTTP/2
4760
4793
 
@@ -4804,7 +4837,7 @@ lib/core/functions/write.md
4804
4837
 
4805
4838
  > **write**(`res`, `data`): `void`
4806
4839
 
4807
- Defined in: [lib/core.ts:1466](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1466)
4840
+ Defined in: [lib/core.ts:1521](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1521)
4808
4841
 
4809
4842
  向 res 发送数据
4810
4843
 
@@ -4900,6 +4933,7 @@ lib/core/index.md
4900
4933
  - [sendProject](functions/sendProject.md)
4901
4934
  - [sendReload](functions/sendReload.md)
4902
4935
  - [sendRestart](functions/sendRestart.md)
4936
+ - [sendStop](functions/sendStop.md)
4903
4937
  - [setCookie](functions/setCookie.md)
4904
4938
  - [setGlobal](functions/setGlobal.md)
4905
4939
  - [sleep](functions/sleep.md)
@@ -4983,7 +5017,7 @@ lib/core/interfaces/ILogOptions.md
4983
5017
 
4984
5018
  # Interface: ILogOptions
4985
5019
 
4986
- Defined in: [lib/core.ts:1136](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1136)
5020
+ Defined in: [lib/core.ts:1191](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1191)
4987
5021
 
4988
5022
  log 设置的选项
4989
5023
 
@@ -4993,7 +5027,7 @@ log 设置的选项
4993
5027
 
4994
5028
  > `optional` **cookie?**: `Record`\<`string`, `string`\>
4995
5029
 
4996
- Defined in: [lib/core.ts:1142](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1142)
5030
+ Defined in: [lib/core.ts:1197](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1197)
4997
5031
 
4998
5032
  ***
4999
5033
 
@@ -5001,7 +5035,7 @@ Defined in: [lib/core.ts:1142](https://github.com/maiyunnet/kebab/blob/master/li
5001
5035
 
5002
5036
  > `optional` **get?**: `Record`\<`string`, `any`\>
5003
5037
 
5004
- Defined in: [lib/core.ts:1141](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1141)
5038
+ Defined in: [lib/core.ts:1196](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1196)
5005
5039
 
5006
5040
  ***
5007
5041
 
@@ -5009,7 +5043,7 @@ Defined in: [lib/core.ts:1141](https://github.com/maiyunnet/kebab/blob/master/li
5009
5043
 
5010
5044
  > `optional` **headers?**: `IncomingHttpHeaders`
5011
5045
 
5012
- Defined in: [lib/core.ts:1144](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1144)
5046
+ Defined in: [lib/core.ts:1199](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1199)
5013
5047
 
5014
5048
  ***
5015
5049
 
@@ -5017,7 +5051,7 @@ Defined in: [lib/core.ts:1144](https://github.com/maiyunnet/kebab/blob/master/li
5017
5051
 
5018
5052
  > `optional` **hostname?**: `string`
5019
5053
 
5020
- Defined in: [lib/core.ts:1139](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1139)
5054
+ Defined in: [lib/core.ts:1194](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1194)
5021
5055
 
5022
5056
  ***
5023
5057
 
@@ -5025,7 +5059,7 @@ Defined in: [lib/core.ts:1139](https://github.com/maiyunnet/kebab/blob/master/li
5025
5059
 
5026
5060
  > `optional` **path?**: `string`
5027
5061
 
5028
- Defined in: [lib/core.ts:1137](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1137)
5062
+ Defined in: [lib/core.ts:1192](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1192)
5029
5063
 
5030
5064
  ***
5031
5065
 
@@ -5033,7 +5067,7 @@ Defined in: [lib/core.ts:1137](https://github.com/maiyunnet/kebab/blob/master/li
5033
5067
 
5034
5068
  > `optional` **req?**: `IncomingMessage` \| `Http2ServerRequest` \| `null`
5035
5069
 
5036
- Defined in: [lib/core.ts:1140](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1140)
5070
+ Defined in: [lib/core.ts:1195](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1195)
5037
5071
 
5038
5072
  ***
5039
5073
 
@@ -5041,7 +5075,7 @@ Defined in: [lib/core.ts:1140](https://github.com/maiyunnet/kebab/blob/master/li
5041
5075
 
5042
5076
  > `optional` **session?**: `Record`\<`string`, `any`\>
5043
5077
 
5044
- Defined in: [lib/core.ts:1143](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1143)
5078
+ Defined in: [lib/core.ts:1198](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1198)
5045
5079
 
5046
5080
  ***
5047
5081
 
@@ -5049,7 +5083,7 @@ Defined in: [lib/core.ts:1143](https://github.com/maiyunnet/kebab/blob/master/li
5049
5083
 
5050
5084
  > `optional` **urlFull?**: `string`
5051
5085
 
5052
- Defined in: [lib/core.ts:1138](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1138)
5086
+ Defined in: [lib/core.ts:1193](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1193)
5053
5087
 
5054
5088
  lib/core/namespaces/v/classes/ValiError.md
5055
5089
  ---
@@ -111469,7 +111503,7 @@ lib/core/type-aliases/TPm2Action.md
111469
111503
 
111470
111504
  > **TPm2Action** = `"start"` \| `"stop"` \| `"restart"`
111471
111505
 
111472
- Defined in: [lib/core.ts:813](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L813)
111506
+ Defined in: [lib/core.ts:867](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L867)
111473
111507
 
111474
111508
  PM2 操作类型
111475
111509
 
@@ -111543,7 +111577,7 @@ lib/core/variables/global.md
111543
111577
 
111544
111578
  > `const` **global**: `Record`\<`string`, `any`\> = `{}`
111545
111579
 
111546
- Defined in: [lib/core.ts:912](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L912)
111580
+ Defined in: [lib/core.ts:967](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L967)
111547
111581
 
111548
111582
  跨进程全局变量
111549
111583
 
@@ -125042,7 +125076,7 @@ lib/undici/functions/fetch.md
125042
125076
 
125043
125077
  > **fetch**(`input`, `init?`): `Promise`\<`Response`\>
125044
125078
 
125045
- Defined in: [lib/undici.ts:260](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L260)
125079
+ Defined in: [lib/undici.ts:261](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L261)
125046
125080
 
125047
125081
  发起一个完全兼容 fetch 的请求
125048
125082
 
@@ -125077,7 +125111,7 @@ lib/undici/functions/filterHeaders.md
125077
125111
 
125078
125112
  > **filterHeaders**(`headers`, `res?`, `filter?`): `Record`\<`string`, `string` \| `string`[]\>
125079
125113
 
125080
- Defined in: [lib/undici.ts:634](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L634)
125114
+ Defined in: [lib/undici.ts:635](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L635)
125081
125115
 
125082
125116
  剔除不代理的 header,返回新的 header
125083
125117
 
@@ -125118,7 +125152,7 @@ lib/undici/functions/getFormData.md
125118
125152
 
125119
125153
  > **getFormData**(): [`FormData`](../formdata/classes/FormData.md)
125120
125154
 
125121
- Defined in: [lib/undici.ts:618](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L618)
125155
+ Defined in: [lib/undici.ts:619](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L619)
125122
125156
 
125123
125157
  创建 FormData 对象
125124
125158
 
@@ -125201,7 +125235,7 @@ lib/undici/functions/getResponseJson.md
125201
125235
 
125202
125236
  > **getResponseJson**(`u`, `opt?`): `Promise`\<`any`\>
125203
125237
 
125204
- Defined in: [lib/undici.ts:248](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L248)
125238
+ Defined in: [lib/undici.ts:249](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L249)
125205
125239
 
125206
125240
  发起 GET 请求并解析 JSON 响应
125207
125241
 
@@ -125238,7 +125272,7 @@ lib/undici/functions/mproxyData.md
125238
125272
 
125239
125273
  > **mproxyData**(`ctr`): `any`
125240
125274
 
125241
- Defined in: [lib/undici.ts:736](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L736)
125275
+ Defined in: [lib/undici.ts:737](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L737)
125242
125276
 
125243
125277
  获取 mproxy 的附加数据
125244
125278
 
@@ -125267,7 +125301,7 @@ lib/undici/functions/mproxy.md
125267
125301
 
125268
125302
  > **mproxy**(`ctr`, `auth`, `opt?`): `Promise`\<`number`\>
125269
125303
 
125270
- Defined in: [lib/undici.ts:674](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L674)
125304
+ Defined in: [lib/undici.ts:675](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L675)
125271
125305
 
125272
125306
  正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
125273
125307
  get: url, auth
@@ -125377,7 +125411,7 @@ lib/undici/functions/postJsonResponseJson.md
125377
125411
 
125378
125412
  > **postJsonResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
125379
125413
 
125380
- Defined in: [lib/undici.ts:220](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L220)
125414
+ Defined in: [lib/undici.ts:221](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L221)
125381
125415
 
125382
125416
  发起 JSON 请求并解析 JSON 响应
125383
125417
 
@@ -125461,7 +125495,7 @@ lib/undici/functions/postResponseJson.md
125461
125495
 
125462
125496
  > **postResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
125463
125497
 
125464
- Defined in: [lib/undici.ts:235](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L235)
125498
+ Defined in: [lib/undici.ts:236](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L236)
125465
125499
 
125466
125500
  发起 POST 请求并解析 JSON 响应
125467
125501
 
@@ -125504,7 +125538,7 @@ lib/undici/functions/request.md
125504
125538
 
125505
125539
  > **request**(`u`, `data?`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
125506
125540
 
125507
- Defined in: [lib/undici.ts:432](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L432)
125541
+ Defined in: [lib/undici.ts:433](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L433)
125508
125542
 
125509
125543
  发起一个请求
125510
125544
 
@@ -125541,7 +125575,7 @@ lib/undici/functions/rproxy.md
125541
125575
 
125542
125576
  > **rproxy**(`ctr`, `route`, `opt?`): `Promise`\<`boolean`\>
125543
125577
 
125544
- Defined in: [lib/undici.ts:766](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L766)
125578
+ Defined in: [lib/undici.ts:767](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L767)
125545
125579
 
125546
125580
  反向代理,将本服务器的某个路由反代到其他网址
125547
125581
 
@@ -125630,7 +125664,7 @@ lib/undici/interfaces/IMproxyOptions.md
125630
125664
 
125631
125665
  # Interface: IMproxyOptions
125632
125666
 
125633
- Defined in: [lib/undici.ts:889](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L889)
125667
+ Defined in: [lib/undici.ts:892](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L892)
125634
125668
 
125635
125669
  正向代理请求的传入参数选项
125636
125670
 
@@ -125640,7 +125674,7 @@ Defined in: [lib/undici.ts:889](https://github.com/maiyunnet/kebab/blob/master/l
125640
125674
 
125641
125675
  > `optional` **filter?**: (`h`) => `boolean`
125642
125676
 
125643
- Defined in: [lib/undici.ts:898](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L898)
125677
+ Defined in: [lib/undici.ts:901](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L901)
125644
125678
 
125645
125679
  过滤 header,返回 true 则留下
125646
125680
 
@@ -125660,7 +125694,7 @@ Defined in: [lib/undici.ts:898](https://github.com/maiyunnet/kebab/blob/master/l
125660
125694
 
125661
125695
  > `optional` **follow?**: `number`
125662
125696
 
125663
- Defined in: [lib/undici.ts:892](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L892)
125697
+ Defined in: [lib/undici.ts:895](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L895)
125664
125698
 
125665
125699
  ***
125666
125700
 
@@ -125668,7 +125702,7 @@ Defined in: [lib/undici.ts:892](https://github.com/maiyunnet/kebab/blob/master/l
125668
125702
 
125669
125703
  > `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
125670
125704
 
125671
- Defined in: [lib/undici.ts:896](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L896)
125705
+ Defined in: [lib/undici.ts:899](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L899)
125672
125706
 
125673
125707
  ***
125674
125708
 
@@ -125676,7 +125710,7 @@ Defined in: [lib/undici.ts:896](https://github.com/maiyunnet/kebab/blob/master/l
125676
125710
 
125677
125711
  > `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
125678
125712
 
125679
- Defined in: [lib/undici.ts:894](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L894)
125713
+ Defined in: [lib/undici.ts:897](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L897)
125680
125714
 
125681
125715
  自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
125682
125716
 
@@ -125686,7 +125720,7 @@ Defined in: [lib/undici.ts:894](https://github.com/maiyunnet/kebab/blob/master/l
125686
125720
 
125687
125721
  > `optional` **local?**: `string`
125688
125722
 
125689
- Defined in: [lib/undici.ts:895](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L895)
125723
+ Defined in: [lib/undici.ts:898](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L898)
125690
125724
 
125691
125725
  ***
125692
125726
 
@@ -125694,7 +125728,7 @@ Defined in: [lib/undici.ts:895](https://github.com/maiyunnet/kebab/blob/master/l
125694
125728
 
125695
125729
  > `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
125696
125730
 
125697
- Defined in: [lib/undici.ts:900](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L900)
125731
+ Defined in: [lib/undici.ts:903](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L903)
125698
125732
 
125699
125733
  默认为 default
125700
125734
 
@@ -125704,7 +125738,7 @@ Defined in: [lib/undici.ts:900](https://github.com/maiyunnet/kebab/blob/master/l
125704
125738
 
125705
125739
  > `optional` **timeout?**: `number`
125706
125740
 
125707
- Defined in: [lib/undici.ts:891](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L891)
125741
+ Defined in: [lib/undici.ts:894](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L894)
125708
125742
 
125709
125743
  秒数,默认 300 秒
125710
125744
 
@@ -125719,7 +125753,7 @@ lib/undici/interfaces/IRequestOptions.md
125719
125753
 
125720
125754
  # Interface: IRequestOptions
125721
125755
 
125722
- Defined in: [lib/undici.ts:852](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L852)
125756
+ Defined in: [lib/undici.ts:853](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L853)
125723
125757
 
125724
125758
  请求的传入参数选项
125725
125759
 
@@ -125729,7 +125763,7 @@ Defined in: [lib/undici.ts:852](https://github.com/maiyunnet/kebab/blob/master/l
125729
125763
 
125730
125764
  > `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
125731
125765
 
125732
- Defined in: [lib/undici.ts:881](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L881)
125766
+ Defined in: [lib/undici.ts:884](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L884)
125733
125767
 
125734
125768
  cookie 托管对象
125735
125769
 
@@ -125739,7 +125773,7 @@ cookie 托管对象
125739
125773
 
125740
125774
  > `optional` **follow?**: `number`
125741
125775
 
125742
- Defined in: [lib/undici.ts:862](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L862)
125776
+ Defined in: [lib/undici.ts:865](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L865)
125743
125777
 
125744
125778
  追踪 location 次数,0 为不追踪,默认为 0
125745
125779
 
@@ -125749,7 +125783,7 @@ Defined in: [lib/undici.ts:862](https://github.com/maiyunnet/kebab/blob/master/l
125749
125783
 
125750
125784
  > `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
125751
125785
 
125752
- Defined in: [lib/undici.ts:867](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L867)
125786
+ Defined in: [lib/undici.ts:870](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L870)
125753
125787
 
125754
125788
  ***
125755
125789
 
@@ -125757,7 +125791,7 @@ Defined in: [lib/undici.ts:867](https://github.com/maiyunnet/kebab/blob/master/l
125757
125791
 
125758
125792
  > `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
125759
125793
 
125760
- Defined in: [lib/undici.ts:864](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L864)
125794
+ Defined in: [lib/undici.ts:867](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L867)
125761
125795
 
125762
125796
  自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
125763
125797
 
@@ -125767,7 +125801,7 @@ Defined in: [lib/undici.ts:864](https://github.com/maiyunnet/kebab/blob/master/l
125767
125801
 
125768
125802
  > `optional` **keep?**: `boolean`
125769
125803
 
125770
- Defined in: [lib/undici.ts:877](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L877)
125804
+ Defined in: [lib/undici.ts:880](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L880)
125771
125805
 
125772
125806
  连接是否保持长连接(即是否允许复用),默认为 true
125773
125807
 
@@ -125777,7 +125811,7 @@ Defined in: [lib/undici.ts:877](https://github.com/maiyunnet/kebab/blob/master/l
125777
125811
 
125778
125812
  > `optional` **local?**: `string`
125779
125813
 
125780
- Defined in: [lib/undici.ts:866](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L866)
125814
+ Defined in: [lib/undici.ts:869](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L869)
125781
125815
 
125782
125816
  ***
125783
125817
 
@@ -125785,7 +125819,7 @@ Defined in: [lib/undici.ts:866](https://github.com/maiyunnet/kebab/blob/master/l
125785
125819
 
125786
125820
  > `optional` **log?**: `boolean`
125787
125821
 
125788
- Defined in: [lib/undici.ts:883](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L883)
125822
+ Defined in: [lib/undici.ts:886](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L886)
125789
125823
 
125790
125824
  若有异常写入文件日志,默认为 true
125791
125825
 
@@ -125795,7 +125829,7 @@ Defined in: [lib/undici.ts:883](https://github.com/maiyunnet/kebab/blob/master/l
125795
125829
 
125796
125830
  > `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
125797
125831
 
125798
- Defined in: [lib/undici.ts:853](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L853)
125832
+ Defined in: [lib/undici.ts:854](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L854)
125799
125833
 
125800
125834
  ***
125801
125835
 
@@ -125803,7 +125837,7 @@ Defined in: [lib/undici.ts:853](https://github.com/maiyunnet/kebab/blob/master/l
125803
125837
 
125804
125838
  > `optional` **mproxy?**: `object`
125805
125839
 
125806
- Defined in: [lib/undici.ts:869](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L869)
125840
+ Defined in: [lib/undici.ts:872](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L872)
125807
125841
 
125808
125842
  正向 mproxy 代理,url 如 https://xxx/abc
125809
125843
 
@@ -125831,7 +125865,7 @@ Defined in: [lib/undici.ts:869](https://github.com/maiyunnet/kebab/blob/master/l
125831
125865
 
125832
125866
  > `optional` **retry?**: `number`
125833
125867
 
125834
- Defined in: [lib/undici.ts:858](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L858)
125868
+ Defined in: [lib/undici.ts:859](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L859)
125835
125869
 
125836
125870
  网络异常后的重试次数,默认 0;流式请求体不可重试,非幂等请求需由调用方保证安全
125837
125871
 
@@ -125841,17 +125875,37 @@ Defined in: [lib/undici.ts:858](https://github.com/maiyunnet/kebab/blob/master/l
125841
125875
 
125842
125876
  > `optional` **retryJson?**: `number`
125843
125877
 
125844
- Defined in: [lib/undici.ts:860](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L860)
125878
+ Defined in: [lib/undici.ts:861](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L861)
125845
125879
 
125846
125880
  JSON 解析失败后的重试次数,默认 0;仅适用于 ResponseJson 快捷方法,非幂等请求需由调用方保证安全
125847
125881
 
125848
125882
  ***
125849
125883
 
125884
+ ### retryJsonHandler?
125885
+
125886
+ > `optional` **retryJsonHandler?**: (`json`) => `boolean`
125887
+
125888
+ Defined in: [lib/undici.ts:863](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L863)
125889
+
125890
+ JSON 重试验证方法;返回 false 时按 retryJson 的设置重试,仅适用于 ResponseJson 快捷方法
125891
+
125892
+ #### Parameters
125893
+
125894
+ ##### json
125895
+
125896
+ `any`
125897
+
125898
+ #### Returns
125899
+
125900
+ `boolean`
125901
+
125902
+ ***
125903
+
125850
125904
  ### reuse?
125851
125905
 
125852
125906
  > `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
125853
125907
 
125854
- Defined in: [lib/undici.ts:879](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L879)
125908
+ Defined in: [lib/undici.ts:882](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L882)
125855
125909
 
125856
125910
  复用池名/Agent,默认为 default
125857
125911
 
@@ -125861,7 +125915,7 @@ Defined in: [lib/undici.ts:879](https://github.com/maiyunnet/kebab/blob/master/l
125861
125915
 
125862
125916
  > `optional` **save?**: `string`
125863
125917
 
125864
- Defined in: [lib/undici.ts:865](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L865)
125918
+ Defined in: [lib/undici.ts:868](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L868)
125865
125919
 
125866
125920
  ***
125867
125921
 
@@ -125869,7 +125923,7 @@ Defined in: [lib/undici.ts:865](https://github.com/maiyunnet/kebab/blob/master/l
125869
125923
 
125870
125924
  > `optional` **signal?**: `AbortSignal`
125871
125925
 
125872
- Defined in: [lib/undici.ts:885](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L885)
125926
+ Defined in: [lib/undici.ts:888](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L888)
125873
125927
 
125874
125928
  请求中止信号
125875
125929
 
@@ -125879,7 +125933,7 @@ Defined in: [lib/undici.ts:885](https://github.com/maiyunnet/kebab/blob/master/l
125879
125933
 
125880
125934
  > `optional` **timeout?**: `number`
125881
125935
 
125882
- Defined in: [lib/undici.ts:856](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L856)
125936
+ Defined in: [lib/undici.ts:857](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L857)
125883
125937
 
125884
125938
  秒数,默认 300 秒
125885
125939
 
@@ -125889,7 +125943,7 @@ Defined in: [lib/undici.ts:856](https://github.com/maiyunnet/kebab/blob/master/l
125889
125943
 
125890
125944
  > `optional` **type?**: `"form"` \| `"json"`
125891
125945
 
125892
- Defined in: [lib/undici.ts:854](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L854)
125946
+ Defined in: [lib/undici.ts:855](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L855)
125893
125947
 
125894
125948
  lib/undici/interfaces/IRproxyOptions.md
125895
125949
  ---
@@ -125902,7 +125956,7 @@ lib/undici/interfaces/IRproxyOptions.md
125902
125956
 
125903
125957
  # Interface: IRproxyOptions
125904
125958
 
125905
- Defined in: [lib/undici.ts:904](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L904)
125959
+ Defined in: [lib/undici.ts:907](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L907)
125906
125960
 
125907
125961
  反向代理请求的传入参数选项
125908
125962
 
@@ -125912,7 +125966,7 @@ Defined in: [lib/undici.ts:904](https://github.com/maiyunnet/kebab/blob/master/l
125912
125966
 
125913
125967
  > `optional` **body?**: `string` \| `Buffer`\<`ArrayBufferLike`\> \| `Readable`
125914
125968
 
125915
- Defined in: [lib/undici.ts:923](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L923)
125969
+ Defined in: [lib/undici.ts:926](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L926)
125916
125970
 
125917
125971
  手动传入请求体(优先于原始 req 流),用于 req 流已消费后仍需转发 body 的场景
125918
125972
 
@@ -125922,7 +125976,7 @@ Defined in: [lib/undici.ts:923](https://github.com/maiyunnet/kebab/blob/master/l
125922
125976
 
125923
125977
  > `optional` **filter?**: (`h`) => `boolean`
125924
125978
 
125925
- Defined in: [lib/undici.ts:913](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L913)
125979
+ Defined in: [lib/undici.ts:916](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L916)
125926
125980
 
125927
125981
  过滤 header,返回 true 则留下
125928
125982
 
@@ -125942,7 +125996,7 @@ Defined in: [lib/undici.ts:913](https://github.com/maiyunnet/kebab/blob/master/l
125942
125996
 
125943
125997
  > `optional` **follow?**: `number`
125944
125998
 
125945
- Defined in: [lib/undici.ts:907](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L907)
125999
+ Defined in: [lib/undici.ts:910](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L910)
125946
126000
 
125947
126001
  ***
125948
126002
 
@@ -125950,7 +126004,7 @@ Defined in: [lib/undici.ts:907](https://github.com/maiyunnet/kebab/blob/master/l
125950
126004
 
125951
126005
  > `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
125952
126006
 
125953
- Defined in: [lib/undici.ts:911](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L911)
126007
+ Defined in: [lib/undici.ts:914](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L914)
125954
126008
 
125955
126009
  ***
125956
126010
 
@@ -125958,7 +126012,7 @@ Defined in: [lib/undici.ts:911](https://github.com/maiyunnet/kebab/blob/master/l
125958
126012
 
125959
126013
  > `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
125960
126014
 
125961
- Defined in: [lib/undici.ts:909](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L909)
126015
+ Defined in: [lib/undici.ts:912](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L912)
125962
126016
 
125963
126017
  自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
125964
126018
 
@@ -125968,7 +126022,7 @@ Defined in: [lib/undici.ts:909](https://github.com/maiyunnet/kebab/blob/master/l
125968
126022
 
125969
126023
  > `optional` **local?**: `string`
125970
126024
 
125971
- Defined in: [lib/undici.ts:910](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L910)
126025
+ Defined in: [lib/undici.ts:913](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L913)
125972
126026
 
125973
126027
  ***
125974
126028
 
@@ -125976,7 +126030,7 @@ Defined in: [lib/undici.ts:910](https://github.com/maiyunnet/kebab/blob/master/l
125976
126030
 
125977
126031
  > `optional` **mproxy?**: `object`
125978
126032
 
125979
- Defined in: [lib/undici.ts:915](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L915)
126033
+ Defined in: [lib/undici.ts:918](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L918)
125980
126034
 
125981
126035
  正向 mproxy 代理,url 如 https://xxx/abc
125982
126036
 
@@ -126004,7 +126058,7 @@ Defined in: [lib/undici.ts:915](https://github.com/maiyunnet/kebab/blob/master/l
126004
126058
 
126005
126059
  > `optional` **querys?**: `Record`\<`string`, `any`\>
126006
126060
 
126007
- Defined in: [lib/undici.ts:925](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L925)
126061
+ Defined in: [lib/undici.ts:928](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L928)
126008
126062
 
126009
126063
  自定义 GET 查询参数,传入后直接替换代理目标 URL 的整个 query string
126010
126064
 
@@ -126014,7 +126068,7 @@ Defined in: [lib/undici.ts:925](https://github.com/maiyunnet/kebab/blob/master/l
126014
126068
 
126015
126069
  > `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
126016
126070
 
126017
- Defined in: [lib/undici.ts:927](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L927)
126071
+ Defined in: [lib/undici.ts:930](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L930)
126018
126072
 
126019
126073
  默认为 default
126020
126074
 
@@ -126024,7 +126078,7 @@ Defined in: [lib/undici.ts:927](https://github.com/maiyunnet/kebab/blob/master/l
126024
126078
 
126025
126079
  > `optional` **timeout?**: `number`
126026
126080
 
126027
- Defined in: [lib/undici.ts:906](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L906)
126081
+ Defined in: [lib/undici.ts:909](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L909)
126028
126082
 
126029
126083
  秒数,默认 300 秒
126030
126084
 
@@ -126535,7 +126589,7 @@ lib/undici/type-aliases/THttpHeaders.md
126535
126589
 
126536
126590
  > **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
126537
126591
 
126538
- Defined in: [lib/undici.ts:932](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L932)
126592
+ Defined in: [lib/undici.ts:935](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L935)
126539
126593
 
126540
126594
  http headers
126541
126595
 
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "9.17.1";
8
+ export declare const VER = "9.17.2";
9
9
  /** --- 框架根目录,以 / 结尾 --- */
10
10
  export declare const ROOT_PATH: string;
11
11
  /** --- 框架的 LIB,以 / 结尾 --- */
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * --- 本文件用来定义每个目录实体地址的常量 ---
7
7
  */
8
8
  /** --- 当前系统版本号 --- */
9
- export const VER = '9.17.1';
9
+ export const VER = '9.17.2';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/core.d.ts CHANGED
@@ -206,6 +206,15 @@ export declare function sendRestart(hosts?: string[] | 'config'): Promise<Record
206
206
  'result': boolean;
207
207
  'return': string;
208
208
  }>>;
209
+ /**
210
+ * --- 向主进程(或局域网同代码机子)发送 stop 操作,停止接收新连接并在现有连接全部结束后退出 ---
211
+ * @param hosts 局域网主机列表,config 表示使用全局配置;不传时通知当前 master
212
+ * @returns 各主机发送结果
213
+ */
214
+ export declare function sendStop(hosts?: string[] | 'config'): Promise<Record<string, {
215
+ 'result': boolean;
216
+ 'return': string;
217
+ }>>;
209
218
  /** --- PM2 操作类型 --- */
210
219
  export type TPm2Action = 'start' | 'stop' | 'restart';
211
220
  /**
@@ -213,6 +222,7 @@ export type TPm2Action = 'start' | 'stop' | 'restart';
213
222
  * @param name PM2 进程名称
214
223
  * @param action PM2 操作类型
215
224
  * @param hosts 局域网列表
225
+ * @returns 各主机是否已接收并排队,不代表 PM2 操作最终执行成功
216
226
  */
217
227
  export declare function sendPm2(name: string, action?: TPm2Action, hosts?: string[] | 'config'): Promise<Record<string, {
218
228
  'result': boolean;
package/lib/core.js CHANGED
@@ -713,11 +713,62 @@ export async function sendRestart(hosts) {
713
713
  }
714
714
  return rtn;
715
715
  }
716
+ /**
717
+ * --- 向主进程(或局域网同代码机子)发送 stop 操作,停止接收新连接并在现有连接全部结束后退出 ---
718
+ * @param hosts 局域网主机列表,config 表示使用全局配置;不传时通知当前 master
719
+ * @returns 各主机发送结果
720
+ */
721
+ export async function sendStop(hosts) {
722
+ if (!hosts) {
723
+ // --- 本地模式 ---
724
+ // eslint-disable-next-line no-console
725
+ console.log('[ Child] Sending stop request...');
726
+ process.send({
727
+ 'action': 'stop'
728
+ });
729
+ return {
730
+ '127.0.0.1': { 'result': true, 'return': 'Done' }
731
+ };
732
+ }
733
+ if (hosts === 'config') {
734
+ hosts = globalConfig.hosts;
735
+ }
736
+ // --- 未传或 config 展开后为空数组,均回退到本机 ---
737
+ if (!hosts?.length) {
738
+ hosts = ['127.0.0.1'];
739
+ }
740
+ // --- 局域网模式 ---
741
+ const time = lTime.stamp();
742
+ /** --- 返回成功的 host --- */
743
+ const rtn = {};
744
+ for (const host of hosts) {
745
+ const res = await lUndici.get('http://' + host + ':' + globalConfig.rpcPort.toString() + '/' + lCrypto.aesEncrypt(lText.stringifyJson({
746
+ 'action': 'stop',
747
+ 'time': time
748
+ }), globalConfig.rpcSecret), {
749
+ 'timeout': 5
750
+ });
751
+ const content = await res.getContent();
752
+ if (!content) {
753
+ rtn[host] = { 'result': false, 'return': 'Timeout' };
754
+ continue;
755
+ }
756
+ const str = content.toString();
757
+ if (str === 'Done') {
758
+ rtn[host] = { 'result': true, 'return': 'Done' };
759
+ }
760
+ else {
761
+ rtn[host] = { 'result': false, 'return': str };
762
+ }
763
+ }
764
+ return rtn;
765
+ }
716
766
  /**
717
767
  * --- 向本机或局域网 RPC 发送 PM2 操作 ---
718
768
  * @param name PM2 进程名称
719
769
  * @param action PM2 操作类型
720
770
  * @param hosts 局域网列表
771
+ * @returns 各主机是否已接收并排队,不代表 PM2 操作最终执行成功
721
772
  */
722
773
  export async function sendPm2(name, action = 'restart', hosts) {
723
774
  if (hosts === 'config') {
package/lib/undici.d.ts CHANGED
@@ -133,6 +133,8 @@ export interface IRequestOptions {
133
133
  'retry'?: number;
134
134
  /** --- JSON 解析失败后的重试次数,默认 0;仅适用于 ResponseJson 快捷方法,非幂等请求需由调用方保证安全 --- */
135
135
  'retryJson'?: number;
136
+ /** --- JSON 重试验证方法;返回 false 时按 retryJson 的设置重试,仅适用于 ResponseJson 快捷方法 --- */
137
+ 'retryJsonHandler'?: (json: kebab.Json) => boolean;
136
138
  /** --- 追踪 location 次数,0 为不追踪,默认为 0 --- */
137
139
  'follow'?: number;
138
140
  /** --- 自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host --- */
package/lib/undici.js CHANGED
@@ -152,7 +152,7 @@ async function requestResponseJson(u, data, opt, action) {
152
152
  }
153
153
  const rtnStr = rtn.toString();
154
154
  const json = lText.parseJson(rtnStr);
155
- if (json) {
155
+ if (json && (opt.retryJsonHandler?.(json) ?? true)) {
156
156
  return json;
157
157
  }
158
158
  if (i < retryJson) {
@@ -162,7 +162,8 @@ async function requestResponseJson(u, data, opt, action) {
162
162
  }
163
163
  if (opt.log === undefined || opt.log) {
164
164
  const requestData = data === undefined ? '' : `, data: ${lText.stringifyJson(data)}`;
165
- lCore.log({}, `[UNDICI][${action}] parse json failed, url: ${u}${requestData}, content: ${rtnStr}`, '-neterror');
165
+ const reason = json ? 'retry json handler returned false' : 'parse json failed';
166
+ lCore.log({}, `[UNDICI][${action}] ${reason}, url: ${u}${requestData}, content: ${rtnStr}`, '-neterror');
166
167
  }
167
168
  return false;
168
169
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "9.17.1",
3
+ "version": "9.17.2",
4
4
  "description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -35,7 +35,7 @@
35
35
  "@tailwindcss/cli": "^4.3.3",
36
36
  "@types/ssh2": "^1.15.5",
37
37
  "ajv": "^8.20.0",
38
- "ajv-formats": "^3.0.1",
38
+ "ajv-formats": "^3.0.1",
39
39
  "class-variance-authority": "^0.7.1",
40
40
  "clsx": "^2.1.1",
41
41
  "ejs": "^6.0.1",
package/sys/child.js CHANGED
@@ -47,6 +47,10 @@ let http2Server;
47
47
  const linkCount = {};
48
48
  /** --- 是否正在停止,停止时对 HTTP/1.1 响应追加 Connection: close,避免请求完成后连接回到保活池 --- */
49
49
  let stopping = false;
50
+ /** --- 当前缓动停止任务,避免重复 IPC 消息触发停止流程 --- */
51
+ let stopPromise = null;
52
+ /** --- 缓动停止是否必须一直等到现有连接全部结束 --- */
53
+ let stopWaitForever = false;
50
54
  /** --- 当前活跃的 HTTP/2 会话集合,用于 graceful shutdown 时发送 GOAWAY 帧 --- */
51
55
  const http2Sessions = new Set();
52
56
  /**
@@ -552,56 +556,66 @@ async function reloadCert() {
552
556
  defaultSc = certList.size > 0 ? certList.values().next().value.sc : undefined;
553
557
  certHostIndex = {};
554
558
  }
559
+ /**
560
+ * --- 停止接收新连接,并在现有请求、上传、异步任务和 WebSocket 全部结束后退出 worker ---
561
+ * @param waitForever 是否取消原有的一小时退出兜底,仅完整 stop 命令使用
562
+ * @returns worker 退出时结束
563
+ */
564
+ async function gracefulStop(waitForever = false) {
565
+ if (waitForever) {
566
+ stopWaitForever = true;
567
+ }
568
+ if (stopPromise) {
569
+ return stopPromise;
570
+ }
571
+ stopping = true;
572
+ stopPromise = (async () => {
573
+ // --- 向所有 HTTP/2 会话发送 GOAWAY 帧,通知客户端停止在该连接上发送新请求并切换到新连接 ---
574
+ for (const session of http2Sessions) {
575
+ try {
576
+ session.goaway(http2.constants.NGHTTP2_NO_ERROR);
577
+ }
578
+ catch { }
579
+ }
580
+ httpServer?.close();
581
+ http2Server?.close();
582
+ // --- 立即关闭空闲保活连接,活跃连接会继续执行并在响应后关闭 ---
583
+ httpServer?.closeIdleConnections();
584
+ clearInterval(hbTimer);
585
+ sMonitor.stop();
586
+ // --- 等待活跃请求全部完成;WebSocket 的路由任务会一直保留到连接关闭 ---
587
+ /** --- 当前已等待时间,restart 最多等待一小时,完整 stop 不限制 --- */
588
+ let waiting = 0;
589
+ while (Object.keys(linkCount).length) {
590
+ const str = [];
591
+ for (const key in linkCount) {
592
+ str.push(key + ':' + linkCount[key].toString());
593
+ }
594
+ lCore.debug(`[CHILD] Worker ${process.pid} busy: ${str.join(',')}.`);
595
+ lCore.log({}, `[CHILD] Worker ${process.pid} busy: ${str.join(',')}.`, '-warning');
596
+ await lCore.sleep(5_000);
597
+ waiting += 5_000;
598
+ // --- 再次清理已变为空闲的保活连接 ---
599
+ httpServer?.closeIdleConnections();
600
+ if (!stopWaitForever && (waiting > 3_600_000)) {
601
+ break;
602
+ }
603
+ }
604
+ process.exit();
605
+ })();
606
+ return stopPromise;
607
+ }
555
608
  // --- 接收主进程回传信号,主要用来 reload,restart ---
556
609
  process.on('message', function (msg) {
557
610
  (async function () {
558
611
  switch (msg.action) {
559
612
  case 'reload': {
560
613
  await reload();
561
- // eslint-disable-next-line no-console
562
- console.log(`[child] Worker ${process.pid} reload execution succeeded.`);
614
+ lCore.display(`[CHILD] Worker ${process.pid} reload execution succeeded.`);
563
615
  break;
564
616
  }
565
617
  case 'stop': {
566
- // --- 需要停止监听,等待已有连接全部断开,然后关闭线程 ---
567
- stopping = true;
568
- // --- 向所有 HTTP/2 会话发送 GOAWAY 帧,通知 CDN 客户端停止在该连接上发送新请求并切换到新连接 ---
569
- for (const session of http2Sessions) {
570
- try {
571
- session.goaway(http2.constants.NGHTTP2_NO_ERROR);
572
- }
573
- catch { }
574
- }
575
- httpServer?.close();
576
- http2Server?.close();
577
- // --- 立即关闭空闲保活连接(无活跃请求的 keep-alive socket),避免进程长时间等待 ---
578
- httpServer?.closeIdleConnections();
579
- clearInterval(hbTimer);
580
- sMonitor.stop();
581
- // --- 等待活跃请求全部完成 ---
582
- /** --- 当前已等待时间,等待不超过 1 小时 --- */
583
- let waiting = 0;
584
- while (true) {
585
- if (!Object.keys(linkCount).length) {
586
- break;
587
- }
588
- // --- 有活跃连接,等待中 ---
589
- const str = [];
590
- for (const key in linkCount) {
591
- str.push(key + ':' + linkCount[key].toString());
592
- }
593
- lCore.debug(`[CHILD] Worker ${process.pid} busy: ${str.join(',')}.`);
594
- lCore.log({}, `[CHILD] Worker ${process.pid} busy: ${str.join(',')}.`, '-warning');
595
- await lCore.sleep(5_000);
596
- waiting += 5_000;
597
- // --- 再次清理已变为空闲的保活连接 ---
598
- httpServer?.closeIdleConnections();
599
- if (waiting > 3600_000) {
600
- break;
601
- }
602
- }
603
- // --- 链接全部断开 ---
604
- process.exit();
618
+ await gracefulStop(msg.waitForever === true);
605
619
  break;
606
620
  }
607
621
  case 'global': {
package/sys/master.js CHANGED
@@ -19,6 +19,10 @@ import * as lTime from '#kebab/lib/time.js';
19
19
  import * as lZip from '#kebab/lib/zip.js';
20
20
  /** --- 当前运行中的子进程列表 --- */
21
21
  const workerList = {};
22
+ /** --- master 是否正在缓动停止 --- */
23
+ let stopping = false;
24
+ /** --- 当前缓动停止任务,避免重复 stop 命令触发 --- */
25
+ let stopPromise = null;
22
26
  /**
23
27
  * --- 判断候选路径是否位于指定根目录内 ---
24
28
  * @param rootPath 已解析的真实根目录
@@ -246,6 +250,12 @@ function createRpcListener() {
246
250
  await restartWorkers();
247
251
  break;
248
252
  }
253
+ case 'stop': {
254
+ gracefulStop().catch((e) => {
255
+ lCore.display('[master] [gracefulStop]', e);
256
+ });
257
+ break;
258
+ }
249
259
  case 'global': {
250
260
  // --- 为所有子进程更新 global 变量 ---
251
261
  for (const pid in workerList) {
@@ -264,7 +274,7 @@ function createRpcListener() {
264
274
  break;
265
275
  }
266
276
  case 'pm2': {
267
- // --- 执行 PM2 操作 ---
277
+ // --- 接收 PM2 操作 ---
268
278
  if (!msg.name || typeof msg.name !== 'string') {
269
279
  res.end('Invalid name');
270
280
  return;
@@ -279,12 +289,18 @@ function createRpcListener() {
279
289
  res.end('Invalid pm2Action');
280
290
  return;
281
291
  }
282
- const rtn = await lCore.exec(`pm2 ${msg.pm2Action} ${msg.name}`);
283
- if (rtn === false) {
284
- res.end('Exec failed');
285
- return;
286
- }
287
- break;
292
+ // --- 先确认已接收,让调用方完成当前 HTTP 响应,再执行可能终止本进程的 PM2 操作 ---
293
+ res.end('Done');
294
+ setTimeout(() => {
295
+ lCore.exec(`pm2 ${msg.pm2Action} ${msg.name}`).then((rtn) => {
296
+ if (rtn === false) {
297
+ lCore.display(`[master] PM2 ${msg.pm2Action} ${msg.name} failed.`);
298
+ }
299
+ }).catch((e) => {
300
+ lCore.display(`[master] PM2 ${msg.pm2Action} ${msg.name} failed.`, e);
301
+ });
302
+ }, 1_000);
303
+ return;
288
304
  }
289
305
  case 'npm': {
290
306
  // --- 执行 npm install 操作 ---
@@ -931,10 +947,59 @@ function createRpcListener() {
931
947
  });
932
948
  }).listen(lCore.globalConfig.rpcPort);
933
949
  }
950
+ /**
951
+ * --- 通知 worker 停止,并等待其现有连接全部结束后退出 ---
952
+ * @param worker 要停止的 worker
953
+ * @returns worker 退出后完成
954
+ */
955
+ function stopWorker(worker) {
956
+ if (worker.isDead()) {
957
+ return Promise.resolve();
958
+ }
959
+ return new Promise((resolve) => {
960
+ worker.once('exit', () => { resolve(); });
961
+ try {
962
+ if (worker.isConnected()) {
963
+ worker.send({
964
+ 'action': 'stop',
965
+ 'waitForever': true,
966
+ });
967
+ return;
968
+ }
969
+ worker.process.kill('SIGTERM');
970
+ }
971
+ catch (e) {
972
+ lCore.display(`[master] Failed to notify worker ${worker.process.pid ?? 'undefined'} to stop, using SIGTERM.`, e);
973
+ worker.process.kill('SIGTERM');
974
+ }
975
+ });
976
+ }
977
+ /**
978
+ * --- 停止命令入口和所有 worker,等待整套 Kebab 进程排空后退出 master ---
979
+ * @returns 全部 worker 退出后完成
980
+ */
981
+ async function gracefulStop() {
982
+ if (stopPromise) {
983
+ return stopPromise;
984
+ }
985
+ stopping = true;
986
+ stopPromise = (async () => {
987
+ lCore.display('[master] Graceful stop started.');
988
+ // --- 包括 restart 时已从 workerList 移除、但仍在排空的旧 worker ---
989
+ const workers = Object.values(cluster.workers ?? {}).filter((worker) => worker !== undefined);
990
+ await Promise.all(workers.map(worker => stopWorker(worker)));
991
+ lCore.display('[master] Graceful stop completed.');
992
+ process.exit(0);
993
+ })();
994
+ return stopPromise;
995
+ }
934
996
  /**
935
997
  * --- 零宕机重启所有 worker 进程:先创建新进程并等待监听就绪,再停止旧进程 ---
936
998
  */
937
999
  async function restartWorkers() {
1000
+ if (stopping) {
1001
+ return;
1002
+ }
938
1003
  // --- 收集旧进程信息(先快照,避免迭代过程中修改 workerList) ---
939
1004
  const oldEntries = [];
940
1005
  for (const pid in workerList) {
@@ -946,6 +1011,9 @@ async function restartWorkers() {
946
1011
  }
947
1012
  // --- 阶段 1:创建新进程并等待其监听端口就绪 ---
948
1013
  for (const entry of oldEntries) {
1014
+ if (stopping) {
1015
+ return;
1016
+ }
949
1017
  const newWorker = await createChildProcess(entry.cpu);
950
1018
  if (newWorker) {
951
1019
  await waitForWorkerListening(newWorker);
@@ -953,6 +1021,9 @@ async function restartWorkers() {
953
1021
  }
954
1022
  // --- 阶段 2:停止旧进程 ---
955
1023
  for (const entry of oldEntries) {
1024
+ if (stopping) {
1025
+ return;
1026
+ }
956
1027
  entry.worker.send({
957
1028
  'action': 'stop'
958
1029
  });
@@ -963,6 +1034,9 @@ async function restartWorkers() {
963
1034
  * --- 检测是否有死掉丢失的子进程,复活之 ---
964
1035
  */
965
1036
  async function checkWorkerLost() {
1037
+ if (stopping) {
1038
+ return;
1039
+ }
966
1040
  const now = Date.now();
967
1041
  for (const pid in workerList) {
968
1042
  if (now - workerList[pid].hbtime < 30000) {
@@ -984,6 +1058,9 @@ async function checkWorkerLost() {
984
1058
  * @param cpu CPU ID
985
1059
  */
986
1060
  async function createChildProcess(cpu) {
1061
+ if (stopping) {
1062
+ return null;
1063
+ }
987
1064
  const worker = cluster.fork();
988
1065
  if (!worker.process.pid) {
989
1066
  return null;
@@ -1017,6 +1094,12 @@ async function createChildProcess(cpu) {
1017
1094
  await restartWorkers();
1018
1095
  break;
1019
1096
  }
1097
+ case 'stop': {
1098
+ gracefulStop().catch((e) => {
1099
+ lCore.display('[master] [gracefulStop]', e);
1100
+ });
1101
+ break;
1102
+ }
1020
1103
  case 'global': {
1021
1104
  // --- 为所有子进程更新 global 变量 ---
1022
1105
  for (const pid in workerList) {
@@ -56,6 +56,7 @@ export default class extends sCtr.Ctr {
56
56
  coreUpdatecode(): Promise<string>;
57
57
  coreReload(): Promise<string>;
58
58
  coreRestart(): Promise<string>;
59
+ coreStop(): Promise<string>;
59
60
  corePm2(): Promise<string>;
60
61
  coreNpm(): Promise<any>;
61
62
  coreGlobal(): Promise<string>;
@@ -169,6 +169,7 @@ export default class extends sCtr.Ctr {
169
169
  `<br><a href="${this._config.const.urlBase}test/core-ls">View "test/core-ls"</a>`,
170
170
  `<br><a href="${this._config.const.urlBase}test/core-reload">View "test/core-reload"</a>`,
171
171
  `<br><a href="${this._config.const.urlBase}test/core-restart">View "test/core-restart"</a>`,
172
+ `<br><a href="${this._config.const.urlBase}test/core-stop">View "test/core-stop"</a>`,
172
173
  `<br><a href="${this._config.const.urlBase}test/core-pm2?name=cron&action=restart">View "test/core-pm2"</a>`,
173
174
  `<br><a href="${this._config.const.urlBase}test/core-npm">View "test/core-npm"</a>`,
174
175
  `<br><a href="${this._config.const.urlBase}test/core-global">View "test/core-global"</a>`,
@@ -1572,6 +1573,10 @@ to: ${to}`
1572
1573
  const list = await lCore.sendRestart();
1573
1574
  return `The restart request has been sent, please review the console.<br>Hosts: ${JSON.stringify(list)}<br><br>` + this._getEnd();
1574
1575
  }
1576
+ async coreStop() {
1577
+ const list = await lCore.sendStop();
1578
+ return `The stop request has been sent, please review the console.<br>Hosts: ${lText.stringifyJson(list)}<br><br>` + this._getEnd();
1579
+ }
1575
1580
  async corePm2() {
1576
1581
  const name = this._get['name'] ?? '';
1577
1582
  const action = (this._get['action'] ?? 'restart');
@@ -2499,10 +2504,29 @@ error: <pre>${JSON.stringify(res.error, null, 4)}</pre>`);
2499
2504
  const echo = [];
2500
2505
  const json = await lUndici.getResponseJson(this._internalUrl + 'test/undici-get-response-json1');
2501
2506
  echo.push(`<pre>const json = await lUndici.getResponseJson('${this._internalUrl}test/undici-get-response-json1');</pre>
2502
- result: <pre>${lText.htmlescape(JSON.stringify(json, null, 4))}</pre>`);
2507
+ result: <pre>${lText.htmlescape(JSON.stringify(json, null, 4))}</pre><hr>`);
2503
2508
  const json2 = await lUndici.getResponseJson(this._internalUrl + 'test/undici-get-response-json2');
2504
2509
  echo.push(`<pre>const json2 = await lUndici.getResponseJson('${this._internalUrl}test/undici-get-response-json2');</pre>
2505
- result: <pre>${lText.htmlescape(JSON.stringify(json2, null, 4))}</pre>`);
2510
+ result: <pre>${lText.htmlescape(JSON.stringify(json2, null, 4))}</pre><hr>`);
2511
+ /** --- JSON 重试验证方法的执行次数 --- */
2512
+ let retryJsonHandlerCount = 0;
2513
+ const json3 = await lUndici.getResponseJson(this._internalUrl + 'test/undici-get-response-json1', {
2514
+ 'retryJson': 1,
2515
+ 'retryJsonHandler': (value) => {
2516
+ ++retryJsonHandlerCount;
2517
+ return (retryJsonHandlerCount > 1) && (value.result === 1);
2518
+ },
2519
+ });
2520
+ echo.push(`<pre>let retryJsonHandlerCount = 0;
2521
+ const json3 = await lUndici.getResponseJson('${this._internalUrl}test/undici-get-response-json1', {
2522
+ 'retryJson': 1,
2523
+ 'retryJsonHandler': (value) => {
2524
+ ++retryJsonHandlerCount;
2525
+ return (retryJsonHandlerCount > 1) && (value.result === 1);
2526
+ },
2527
+ });</pre>
2528
+ handler count: ${retryJsonHandlerCount}
2529
+ result: <pre>${lText.htmlescape(JSON.stringify(json3, null, 4))}</pre>`);
2506
2530
  return echo.join('') + '<br>' + this._getEnd();
2507
2531
  }
2508
2532
  undiciGetResponseJson1() {