@maiyunnet/kebab 9.13.6 → 9.13.7
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 +172 -84
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/net.d.ts +8 -0
- package/lib/net.js +20 -0
- package/lib/undici.d.ts +8 -0
- package/lib/undici.js +20 -0
- package/package.json +1 -1
package/doc/kebab-rag.md
CHANGED
|
@@ -1360,7 +1360,7 @@ index/variables/VER.md
|
|
|
1360
1360
|
|
|
1361
1361
|
# Variable: VER
|
|
1362
1362
|
|
|
1363
|
-
> `const` **VER**: `"9.13.
|
|
1363
|
+
> `const` **VER**: `"9.13.7"` = `'9.13.7'`
|
|
1364
1364
|
|
|
1365
1365
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1366
1366
|
|
|
@@ -11023,7 +11023,7 @@ lib/net/functions/fetch.md
|
|
|
11023
11023
|
|
|
11024
11024
|
> **fetch**(`input`, `init?`): `Promise`\<`Response`\>
|
|
11025
11025
|
|
|
11026
|
-
Defined in: [lib/net.ts:
|
|
11026
|
+
Defined in: [lib/net.ts:178](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L178)
|
|
11027
11027
|
|
|
11028
11028
|
发起一个完全兼容 fetch 的请求
|
|
11029
11029
|
|
|
@@ -11058,7 +11058,7 @@ lib/net/functions/filterHeaders.md
|
|
|
11058
11058
|
|
|
11059
11059
|
> **filterHeaders**(`headers`, `res?`, `filter?`): `Record`\<`string`, `string` \| `string`[]\>
|
|
11060
11060
|
|
|
11061
|
-
Defined in: [lib/net.ts:
|
|
11061
|
+
Defined in: [lib/net.ts:533](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L533)
|
|
11062
11062
|
|
|
11063
11063
|
剔除不代理的 header,返回新的 header
|
|
11064
11064
|
|
|
@@ -11120,7 +11120,7 @@ lib/net/functions/getFormData.md
|
|
|
11120
11120
|
|
|
11121
11121
|
> **getFormData**(): [`FormData`](../formdata/classes/FormData.md)
|
|
11122
11122
|
|
|
11123
|
-
Defined in: [lib/net.ts:
|
|
11123
|
+
Defined in: [lib/net.ts:517](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L517)
|
|
11124
11124
|
|
|
11125
11125
|
创建 FormData 对象
|
|
11126
11126
|
|
|
@@ -11176,7 +11176,7 @@ lib/net/functions/getResponseJson.md
|
|
|
11176
11176
|
|
|
11177
11177
|
> **getResponseJson**(`u`, `opt?`): `Promise`\<`any`\>
|
|
11178
11178
|
|
|
11179
|
-
Defined in: [lib/net.ts:
|
|
11179
|
+
Defined in: [lib/net.ts:157](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L157)
|
|
11180
11180
|
|
|
11181
11181
|
发起 GET 请求并解析 JSON 响应
|
|
11182
11182
|
|
|
@@ -11213,7 +11213,7 @@ lib/net/functions/mproxyData.md
|
|
|
11213
11213
|
|
|
11214
11214
|
> **mproxyData**(`ctr`): `any`
|
|
11215
11215
|
|
|
11216
|
-
Defined in: [lib/net.ts:
|
|
11216
|
+
Defined in: [lib/net.ts:621](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L621)
|
|
11217
11217
|
|
|
11218
11218
|
获取 mproxy 的附加数据
|
|
11219
11219
|
|
|
@@ -11242,7 +11242,7 @@ lib/net/functions/mproxy.md
|
|
|
11242
11242
|
|
|
11243
11243
|
> **mproxy**(`ctr`, `auth`, `opt?`): `Promise`\<`number`\>
|
|
11244
11244
|
|
|
11245
|
-
Defined in: [lib/net.ts:
|
|
11245
|
+
Defined in: [lib/net.ts:569](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L569)
|
|
11246
11246
|
|
|
11247
11247
|
正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
|
|
11248
11248
|
get: url, auth
|
|
@@ -11423,6 +11423,49 @@ Defined in: [lib/net.ts:79](https://github.com/maiyunnet/kebab/blob/master/lib/n
|
|
|
11423
11423
|
|
|
11424
11424
|
`Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
11425
11425
|
|
|
11426
|
+
lib/net/functions/postResponseJson.md
|
|
11427
|
+
---
|
|
11428
|
+
|
|
11429
|
+
[**Documents for @maiyunnet/kebab**](../../../index.md)
|
|
11430
|
+
|
|
11431
|
+
***
|
|
11432
|
+
|
|
11433
|
+
[Documents for @maiyunnet/kebab](../../../index.md) / [lib/net](../index.md) / postResponseJson
|
|
11434
|
+
|
|
11435
|
+
# Function: postResponseJson()
|
|
11436
|
+
|
|
11437
|
+
> **postResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
|
|
11438
|
+
|
|
11439
|
+
Defined in: [lib/net.ts:135](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L135)
|
|
11440
|
+
|
|
11441
|
+
发起 POST 请求并解析 JSON 响应
|
|
11442
|
+
|
|
11443
|
+
## Parameters
|
|
11444
|
+
|
|
11445
|
+
### u
|
|
11446
|
+
|
|
11447
|
+
`string`
|
|
11448
|
+
|
|
11449
|
+
网址
|
|
11450
|
+
|
|
11451
|
+
### data
|
|
11452
|
+
|
|
11453
|
+
`Record`\<`string`, [`Json`](../../../index/type-aliases/Json.md)\>
|
|
11454
|
+
|
|
11455
|
+
数据
|
|
11456
|
+
|
|
11457
|
+
### opt?
|
|
11458
|
+
|
|
11459
|
+
[`IRequestOptions`](../interfaces/IRequestOptions.md) = `{}`
|
|
11460
|
+
|
|
11461
|
+
选项
|
|
11462
|
+
|
|
11463
|
+
## Returns
|
|
11464
|
+
|
|
11465
|
+
`Promise`\<`any`\>
|
|
11466
|
+
|
|
11467
|
+
JSON 数据,失败时返回 null
|
|
11468
|
+
|
|
11426
11469
|
lib/net/functions/request.md
|
|
11427
11470
|
---
|
|
11428
11471
|
|
|
@@ -11436,7 +11479,7 @@ lib/net/functions/request.md
|
|
|
11436
11479
|
|
|
11437
11480
|
> **request**(`u`, `data?`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
11438
11481
|
|
|
11439
|
-
Defined in: [lib/net.ts:
|
|
11482
|
+
Defined in: [lib/net.ts:328](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L328)
|
|
11440
11483
|
|
|
11441
11484
|
发起一个请求
|
|
11442
11485
|
|
|
@@ -11473,7 +11516,7 @@ lib/net/functions/rproxy.md
|
|
|
11473
11516
|
|
|
11474
11517
|
> **rproxy**(`ctr`, `route`, `opt?`): `Promise`\<`boolean`\>
|
|
11475
11518
|
|
|
11476
|
-
Defined in: [lib/net.ts:
|
|
11519
|
+
Defined in: [lib/net.ts:639](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L639)
|
|
11477
11520
|
|
|
11478
11521
|
反向代理,注意提前处理不要自动处理 post 数据,将本服务器的某个路由反代到其他网址
|
|
11479
11522
|
|
|
@@ -11536,6 +11579,7 @@ lib/net/index.md
|
|
|
11536
11579
|
- [post](functions/post.md)
|
|
11537
11580
|
- [postJson](functions/postJson.md)
|
|
11538
11581
|
- [postJsonResponseJson](functions/postJsonResponseJson.md)
|
|
11582
|
+
- [postResponseJson](functions/postResponseJson.md)
|
|
11539
11583
|
- [request](functions/request.md)
|
|
11540
11584
|
- [rproxy](functions/rproxy.md)
|
|
11541
11585
|
|
|
@@ -11550,7 +11594,7 @@ lib/net/interfaces/IMproxyOptions.md
|
|
|
11550
11594
|
|
|
11551
11595
|
# Interface: IMproxyOptions
|
|
11552
11596
|
|
|
11553
|
-
Defined in: [lib/net.ts:
|
|
11597
|
+
Defined in: [lib/net.ts:723](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L723)
|
|
11554
11598
|
|
|
11555
11599
|
正向代理请求的传入参数选项
|
|
11556
11600
|
|
|
@@ -11560,7 +11604,7 @@ Defined in: [lib/net.ts:700](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11560
11604
|
|
|
11561
11605
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
11562
11606
|
|
|
11563
|
-
Defined in: [lib/net.ts:
|
|
11607
|
+
Defined in: [lib/net.ts:732](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L732)
|
|
11564
11608
|
|
|
11565
11609
|
过滤 header,返回 true 则留下
|
|
11566
11610
|
|
|
@@ -11580,7 +11624,7 @@ Defined in: [lib/net.ts:709](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11580
11624
|
|
|
11581
11625
|
> `optional` **follow?**: `number`
|
|
11582
11626
|
|
|
11583
|
-
Defined in: [lib/net.ts:
|
|
11627
|
+
Defined in: [lib/net.ts:726](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L726)
|
|
11584
11628
|
|
|
11585
11629
|
***
|
|
11586
11630
|
|
|
@@ -11588,7 +11632,7 @@ Defined in: [lib/net.ts:703](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11588
11632
|
|
|
11589
11633
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
11590
11634
|
|
|
11591
|
-
Defined in: [lib/net.ts:
|
|
11635
|
+
Defined in: [lib/net.ts:730](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L730)
|
|
11592
11636
|
|
|
11593
11637
|
***
|
|
11594
11638
|
|
|
@@ -11596,7 +11640,7 @@ Defined in: [lib/net.ts:707](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11596
11640
|
|
|
11597
11641
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
11598
11642
|
|
|
11599
|
-
Defined in: [lib/net.ts:
|
|
11643
|
+
Defined in: [lib/net.ts:728](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L728)
|
|
11600
11644
|
|
|
11601
11645
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
11602
11646
|
|
|
@@ -11606,7 +11650,7 @@ Defined in: [lib/net.ts:705](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11606
11650
|
|
|
11607
11651
|
> `optional` **local?**: `string`
|
|
11608
11652
|
|
|
11609
|
-
Defined in: [lib/net.ts:
|
|
11653
|
+
Defined in: [lib/net.ts:729](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L729)
|
|
11610
11654
|
|
|
11611
11655
|
***
|
|
11612
11656
|
|
|
@@ -11614,7 +11658,7 @@ Defined in: [lib/net.ts:706](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11614
11658
|
|
|
11615
11659
|
> `optional` **reuse?**: `string`
|
|
11616
11660
|
|
|
11617
|
-
Defined in: [lib/net.ts:
|
|
11661
|
+
Defined in: [lib/net.ts:734](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L734)
|
|
11618
11662
|
|
|
11619
11663
|
默认为 default
|
|
11620
11664
|
|
|
@@ -11624,7 +11668,7 @@ Defined in: [lib/net.ts:711](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11624
11668
|
|
|
11625
11669
|
> `optional` **timeout?**: `number`
|
|
11626
11670
|
|
|
11627
|
-
Defined in: [lib/net.ts:
|
|
11671
|
+
Defined in: [lib/net.ts:725](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L725)
|
|
11628
11672
|
|
|
11629
11673
|
秒数
|
|
11630
11674
|
|
|
@@ -11639,7 +11683,7 @@ lib/net/interfaces/IRequestOptions.md
|
|
|
11639
11683
|
|
|
11640
11684
|
# Interface: IRequestOptions
|
|
11641
11685
|
|
|
11642
|
-
Defined in: [lib/net.ts:
|
|
11686
|
+
Defined in: [lib/net.ts:692](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L692)
|
|
11643
11687
|
|
|
11644
11688
|
请求的传入参数选项
|
|
11645
11689
|
|
|
@@ -11649,7 +11693,7 @@ Defined in: [lib/net.ts:669](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11649
11693
|
|
|
11650
11694
|
> `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
|
|
11651
11695
|
|
|
11652
|
-
Defined in: [lib/net.ts:
|
|
11696
|
+
Defined in: [lib/net.ts:717](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L717)
|
|
11653
11697
|
|
|
11654
11698
|
cookie 托管对象
|
|
11655
11699
|
|
|
@@ -11659,7 +11703,7 @@ cookie 托管对象
|
|
|
11659
11703
|
|
|
11660
11704
|
> `optional` **follow?**: `number`
|
|
11661
11705
|
|
|
11662
|
-
Defined in: [lib/net.ts:
|
|
11706
|
+
Defined in: [lib/net.ts:698](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L698)
|
|
11663
11707
|
|
|
11664
11708
|
追踪 location 次数,0 为不追踪,默认为 0
|
|
11665
11709
|
|
|
@@ -11669,7 +11713,7 @@ Defined in: [lib/net.ts:675](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11669
11713
|
|
|
11670
11714
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
11671
11715
|
|
|
11672
|
-
Defined in: [lib/net.ts:
|
|
11716
|
+
Defined in: [lib/net.ts:703](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L703)
|
|
11673
11717
|
|
|
11674
11718
|
***
|
|
11675
11719
|
|
|
@@ -11677,7 +11721,7 @@ Defined in: [lib/net.ts:680](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11677
11721
|
|
|
11678
11722
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
11679
11723
|
|
|
11680
|
-
Defined in: [lib/net.ts:
|
|
11724
|
+
Defined in: [lib/net.ts:700](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L700)
|
|
11681
11725
|
|
|
11682
11726
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
11683
11727
|
|
|
@@ -11687,7 +11731,7 @@ Defined in: [lib/net.ts:677](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11687
11731
|
|
|
11688
11732
|
> `optional` **keep?**: `boolean`
|
|
11689
11733
|
|
|
11690
|
-
Defined in: [lib/net.ts:
|
|
11734
|
+
Defined in: [lib/net.ts:713](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L713)
|
|
11691
11735
|
|
|
11692
11736
|
连接是否保持长连接(即是否允许复用),默认为 true
|
|
11693
11737
|
|
|
@@ -11697,7 +11741,7 @@ Defined in: [lib/net.ts:690](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11697
11741
|
|
|
11698
11742
|
> `optional` **local?**: `string`
|
|
11699
11743
|
|
|
11700
|
-
Defined in: [lib/net.ts:
|
|
11744
|
+
Defined in: [lib/net.ts:702](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L702)
|
|
11701
11745
|
|
|
11702
11746
|
***
|
|
11703
11747
|
|
|
@@ -11705,7 +11749,7 @@ Defined in: [lib/net.ts:679](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11705
11749
|
|
|
11706
11750
|
> `optional` **log?**: `boolean`
|
|
11707
11751
|
|
|
11708
|
-
Defined in: [lib/net.ts:
|
|
11752
|
+
Defined in: [lib/net.ts:719](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L719)
|
|
11709
11753
|
|
|
11710
11754
|
若有异常写入文件日志,默认为 true
|
|
11711
11755
|
|
|
@@ -11715,7 +11759,7 @@ Defined in: [lib/net.ts:696](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11715
11759
|
|
|
11716
11760
|
> `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
|
|
11717
11761
|
|
|
11718
|
-
Defined in: [lib/net.ts:
|
|
11762
|
+
Defined in: [lib/net.ts:693](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L693)
|
|
11719
11763
|
|
|
11720
11764
|
***
|
|
11721
11765
|
|
|
@@ -11723,7 +11767,7 @@ Defined in: [lib/net.ts:670](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11723
11767
|
|
|
11724
11768
|
> `optional` **mproxy?**: `object`
|
|
11725
11769
|
|
|
11726
|
-
Defined in: [lib/net.ts:
|
|
11770
|
+
Defined in: [lib/net.ts:705](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L705)
|
|
11727
11771
|
|
|
11728
11772
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
11729
11773
|
|
|
@@ -11751,7 +11795,7 @@ Defined in: [lib/net.ts:682](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11751
11795
|
|
|
11752
11796
|
> `optional` **reuse?**: `string`
|
|
11753
11797
|
|
|
11754
|
-
Defined in: [lib/net.ts:
|
|
11798
|
+
Defined in: [lib/net.ts:715](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L715)
|
|
11755
11799
|
|
|
11756
11800
|
复用池名,默认为 default
|
|
11757
11801
|
|
|
@@ -11761,7 +11805,7 @@ Defined in: [lib/net.ts:692](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11761
11805
|
|
|
11762
11806
|
> `optional` **save?**: `string`
|
|
11763
11807
|
|
|
11764
|
-
Defined in: [lib/net.ts:
|
|
11808
|
+
Defined in: [lib/net.ts:701](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L701)
|
|
11765
11809
|
|
|
11766
11810
|
***
|
|
11767
11811
|
|
|
@@ -11769,7 +11813,7 @@ Defined in: [lib/net.ts:678](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11769
11813
|
|
|
11770
11814
|
> `optional` **timeout?**: `number`
|
|
11771
11815
|
|
|
11772
|
-
Defined in: [lib/net.ts:
|
|
11816
|
+
Defined in: [lib/net.ts:696](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L696)
|
|
11773
11817
|
|
|
11774
11818
|
秒数,默认 10 秒
|
|
11775
11819
|
|
|
@@ -11779,7 +11823,7 @@ Defined in: [lib/net.ts:673](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11779
11823
|
|
|
11780
11824
|
> `optional` **type?**: `"form"` \| `"json"`
|
|
11781
11825
|
|
|
11782
|
-
Defined in: [lib/net.ts:
|
|
11826
|
+
Defined in: [lib/net.ts:694](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L694)
|
|
11783
11827
|
|
|
11784
11828
|
lib/net/interfaces/IRproxyOptions.md
|
|
11785
11829
|
---
|
|
@@ -11792,7 +11836,7 @@ lib/net/interfaces/IRproxyOptions.md
|
|
|
11792
11836
|
|
|
11793
11837
|
# Interface: IRproxyOptions
|
|
11794
11838
|
|
|
11795
|
-
Defined in: [lib/net.ts:
|
|
11839
|
+
Defined in: [lib/net.ts:738](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L738)
|
|
11796
11840
|
|
|
11797
11841
|
反向代理请求的传入参数选项
|
|
11798
11842
|
|
|
@@ -11802,7 +11846,7 @@ Defined in: [lib/net.ts:715](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11802
11846
|
|
|
11803
11847
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
11804
11848
|
|
|
11805
|
-
Defined in: [lib/net.ts:
|
|
11849
|
+
Defined in: [lib/net.ts:747](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L747)
|
|
11806
11850
|
|
|
11807
11851
|
过滤 header,返回 true 则留下
|
|
11808
11852
|
|
|
@@ -11822,7 +11866,7 @@ Defined in: [lib/net.ts:724](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11822
11866
|
|
|
11823
11867
|
> `optional` **follow?**: `number`
|
|
11824
11868
|
|
|
11825
|
-
Defined in: [lib/net.ts:
|
|
11869
|
+
Defined in: [lib/net.ts:741](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L741)
|
|
11826
11870
|
|
|
11827
11871
|
***
|
|
11828
11872
|
|
|
@@ -11830,7 +11874,7 @@ Defined in: [lib/net.ts:718](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11830
11874
|
|
|
11831
11875
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
11832
11876
|
|
|
11833
|
-
Defined in: [lib/net.ts:
|
|
11877
|
+
Defined in: [lib/net.ts:745](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L745)
|
|
11834
11878
|
|
|
11835
11879
|
***
|
|
11836
11880
|
|
|
@@ -11838,7 +11882,7 @@ Defined in: [lib/net.ts:722](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11838
11882
|
|
|
11839
11883
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
11840
11884
|
|
|
11841
|
-
Defined in: [lib/net.ts:
|
|
11885
|
+
Defined in: [lib/net.ts:743](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L743)
|
|
11842
11886
|
|
|
11843
11887
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
11844
11888
|
|
|
@@ -11848,7 +11892,7 @@ Defined in: [lib/net.ts:720](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11848
11892
|
|
|
11849
11893
|
> `optional` **local?**: `string`
|
|
11850
11894
|
|
|
11851
|
-
Defined in: [lib/net.ts:
|
|
11895
|
+
Defined in: [lib/net.ts:744](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L744)
|
|
11852
11896
|
|
|
11853
11897
|
***
|
|
11854
11898
|
|
|
@@ -11856,7 +11900,7 @@ Defined in: [lib/net.ts:721](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11856
11900
|
|
|
11857
11901
|
> `optional` **mproxy?**: `object`
|
|
11858
11902
|
|
|
11859
|
-
Defined in: [lib/net.ts:
|
|
11903
|
+
Defined in: [lib/net.ts:749](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L749)
|
|
11860
11904
|
|
|
11861
11905
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
11862
11906
|
|
|
@@ -11884,7 +11928,7 @@ Defined in: [lib/net.ts:726](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11884
11928
|
|
|
11885
11929
|
> `optional` **reuse?**: `string`
|
|
11886
11930
|
|
|
11887
|
-
Defined in: [lib/net.ts:
|
|
11931
|
+
Defined in: [lib/net.ts:757](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L757)
|
|
11888
11932
|
|
|
11889
11933
|
默认为 default
|
|
11890
11934
|
|
|
@@ -11894,7 +11938,7 @@ Defined in: [lib/net.ts:734](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11894
11938
|
|
|
11895
11939
|
> `optional` **timeout?**: `number`
|
|
11896
11940
|
|
|
11897
|
-
Defined in: [lib/net.ts:
|
|
11941
|
+
Defined in: [lib/net.ts:740](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L740)
|
|
11898
11942
|
|
|
11899
11943
|
秒数
|
|
11900
11944
|
|
|
@@ -12355,7 +12399,7 @@ lib/net/type-aliases/THttpHeaders.md
|
|
|
12355
12399
|
|
|
12356
12400
|
> **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
|
|
12357
12401
|
|
|
12358
|
-
Defined in: [lib/net.ts:
|
|
12402
|
+
Defined in: [lib/net.ts:762](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L762)
|
|
12359
12403
|
|
|
12360
12404
|
http headers
|
|
12361
12405
|
|
|
@@ -18286,7 +18330,7 @@ lib/undici/functions/fetch.md
|
|
|
18286
18330
|
|
|
18287
18331
|
> **fetch**(`input`, `init?`): `Promise`\<`Response`\>
|
|
18288
18332
|
|
|
18289
|
-
Defined in: [lib/undici.ts:
|
|
18333
|
+
Defined in: [lib/undici.ts:198](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L198)
|
|
18290
18334
|
|
|
18291
18335
|
发起一个完全兼容 fetch 的请求
|
|
18292
18336
|
|
|
@@ -18321,7 +18365,7 @@ lib/undici/functions/filterHeaders.md
|
|
|
18321
18365
|
|
|
18322
18366
|
> **filterHeaders**(`headers`, `res?`, `filter?`): `Record`\<`string`, `string` \| `string`[]\>
|
|
18323
18367
|
|
|
18324
|
-
Defined in: [lib/undici.ts:
|
|
18368
|
+
Defined in: [lib/undici.ts:554](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L554)
|
|
18325
18369
|
|
|
18326
18370
|
剔除不代理的 header,返回新的 header
|
|
18327
18371
|
|
|
@@ -18362,7 +18406,7 @@ lib/undici/functions/getFormData.md
|
|
|
18362
18406
|
|
|
18363
18407
|
> **getFormData**(): [`FormData`](../formdata/classes/FormData.md)
|
|
18364
18408
|
|
|
18365
|
-
Defined in: [lib/undici.ts:
|
|
18409
|
+
Defined in: [lib/undici.ts:538](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L538)
|
|
18366
18410
|
|
|
18367
18411
|
创建 FormData 对象
|
|
18368
18412
|
|
|
@@ -18445,7 +18489,7 @@ lib/undici/functions/getResponseJson.md
|
|
|
18445
18489
|
|
|
18446
18490
|
> **getResponseJson**(`u`, `opt?`): `Promise`\<`any`\>
|
|
18447
18491
|
|
|
18448
|
-
Defined in: [lib/undici.ts:
|
|
18492
|
+
Defined in: [lib/undici.ts:177](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L177)
|
|
18449
18493
|
|
|
18450
18494
|
发起 GET 请求并解析 JSON 响应
|
|
18451
18495
|
|
|
@@ -18482,7 +18526,7 @@ lib/undici/functions/mproxyData.md
|
|
|
18482
18526
|
|
|
18483
18527
|
> **mproxyData**(`ctr`): `any`
|
|
18484
18528
|
|
|
18485
|
-
Defined in: [lib/undici.ts:
|
|
18529
|
+
Defined in: [lib/undici.ts:656](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L656)
|
|
18486
18530
|
|
|
18487
18531
|
获取 mproxy 的附加数据
|
|
18488
18532
|
|
|
@@ -18511,7 +18555,7 @@ lib/undici/functions/mproxy.md
|
|
|
18511
18555
|
|
|
18512
18556
|
> **mproxy**(`ctr`, `auth`, `opt?`): `Promise`\<`number`\>
|
|
18513
18557
|
|
|
18514
|
-
Defined in: [lib/undici.ts:
|
|
18558
|
+
Defined in: [lib/undici.ts:594](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L594)
|
|
18515
18559
|
|
|
18516
18560
|
正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
|
|
18517
18561
|
get: url, auth
|
|
@@ -18690,6 +18734,49 @@ Defined in: [lib/undici.ts:100](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18690
18734
|
|
|
18691
18735
|
`Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18692
18736
|
|
|
18737
|
+
lib/undici/functions/postResponseJson.md
|
|
18738
|
+
---
|
|
18739
|
+
|
|
18740
|
+
[**Documents for @maiyunnet/kebab**](../../../index.md)
|
|
18741
|
+
|
|
18742
|
+
***
|
|
18743
|
+
|
|
18744
|
+
[Documents for @maiyunnet/kebab](../../../index.md) / [lib/undici](../index.md) / postResponseJson
|
|
18745
|
+
|
|
18746
|
+
# Function: postResponseJson()
|
|
18747
|
+
|
|
18748
|
+
> **postResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
|
|
18749
|
+
|
|
18750
|
+
Defined in: [lib/undici.ts:155](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L155)
|
|
18751
|
+
|
|
18752
|
+
发起 POST 请求并解析 JSON 响应
|
|
18753
|
+
|
|
18754
|
+
## Parameters
|
|
18755
|
+
|
|
18756
|
+
### u
|
|
18757
|
+
|
|
18758
|
+
`string`
|
|
18759
|
+
|
|
18760
|
+
网址
|
|
18761
|
+
|
|
18762
|
+
### data
|
|
18763
|
+
|
|
18764
|
+
`Record`\<`string`, [`Json`](../../../index/type-aliases/Json.md)\>
|
|
18765
|
+
|
|
18766
|
+
数据
|
|
18767
|
+
|
|
18768
|
+
### opt?
|
|
18769
|
+
|
|
18770
|
+
[`IRequestOptions`](../interfaces/IRequestOptions.md) = `{}`
|
|
18771
|
+
|
|
18772
|
+
选项
|
|
18773
|
+
|
|
18774
|
+
## Returns
|
|
18775
|
+
|
|
18776
|
+
`Promise`\<`any`\>
|
|
18777
|
+
|
|
18778
|
+
JSON 数据,失败时返回 null
|
|
18779
|
+
|
|
18693
18780
|
lib/undici/functions/request.md
|
|
18694
18781
|
---
|
|
18695
18782
|
|
|
@@ -18703,7 +18790,7 @@ lib/undici/functions/request.md
|
|
|
18703
18790
|
|
|
18704
18791
|
> **request**(`u`, `data?`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18705
18792
|
|
|
18706
|
-
Defined in: [lib/undici.ts:
|
|
18793
|
+
Defined in: [lib/undici.ts:367](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L367)
|
|
18707
18794
|
|
|
18708
18795
|
发起一个请求
|
|
18709
18796
|
|
|
@@ -18740,7 +18827,7 @@ lib/undici/functions/rproxy.md
|
|
|
18740
18827
|
|
|
18741
18828
|
> **rproxy**(`ctr`, `route`, `opt?`): `Promise`\<`boolean`\>
|
|
18742
18829
|
|
|
18743
|
-
Defined in: [lib/undici.ts:
|
|
18830
|
+
Defined in: [lib/undici.ts:686](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L686)
|
|
18744
18831
|
|
|
18745
18832
|
反向代理,将本服务器的某个路由反代到其他网址
|
|
18746
18833
|
|
|
@@ -18814,6 +18901,7 @@ lib/undici/index.md
|
|
|
18814
18901
|
- [post](functions/post.md)
|
|
18815
18902
|
- [postJson](functions/postJson.md)
|
|
18816
18903
|
- [postJsonResponseJson](functions/postJsonResponseJson.md)
|
|
18904
|
+
- [postResponseJson](functions/postResponseJson.md)
|
|
18817
18905
|
- [request](functions/request.md)
|
|
18818
18906
|
- [rproxy](functions/rproxy.md)
|
|
18819
18907
|
|
|
@@ -18828,7 +18916,7 @@ lib/undici/interfaces/IMproxyOptions.md
|
|
|
18828
18916
|
|
|
18829
18917
|
# Interface: IMproxyOptions
|
|
18830
18918
|
|
|
18831
|
-
Defined in: [lib/undici.ts:
|
|
18919
|
+
Defined in: [lib/undici.ts:803](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L803)
|
|
18832
18920
|
|
|
18833
18921
|
正向代理请求的传入参数选项
|
|
18834
18922
|
|
|
@@ -18838,7 +18926,7 @@ Defined in: [lib/undici.ts:780](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18838
18926
|
|
|
18839
18927
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
18840
18928
|
|
|
18841
|
-
Defined in: [lib/undici.ts:
|
|
18929
|
+
Defined in: [lib/undici.ts:812](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L812)
|
|
18842
18930
|
|
|
18843
18931
|
过滤 header,返回 true 则留下
|
|
18844
18932
|
|
|
@@ -18858,7 +18946,7 @@ Defined in: [lib/undici.ts:789](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18858
18946
|
|
|
18859
18947
|
> `optional` **follow?**: `number`
|
|
18860
18948
|
|
|
18861
|
-
Defined in: [lib/undici.ts:
|
|
18949
|
+
Defined in: [lib/undici.ts:806](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L806)
|
|
18862
18950
|
|
|
18863
18951
|
***
|
|
18864
18952
|
|
|
@@ -18866,7 +18954,7 @@ Defined in: [lib/undici.ts:783](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18866
18954
|
|
|
18867
18955
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18868
18956
|
|
|
18869
|
-
Defined in: [lib/undici.ts:
|
|
18957
|
+
Defined in: [lib/undici.ts:810](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L810)
|
|
18870
18958
|
|
|
18871
18959
|
***
|
|
18872
18960
|
|
|
@@ -18874,7 +18962,7 @@ Defined in: [lib/undici.ts:787](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18874
18962
|
|
|
18875
18963
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18876
18964
|
|
|
18877
|
-
Defined in: [lib/undici.ts:
|
|
18965
|
+
Defined in: [lib/undici.ts:808](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L808)
|
|
18878
18966
|
|
|
18879
18967
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18880
18968
|
|
|
@@ -18884,7 +18972,7 @@ Defined in: [lib/undici.ts:785](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18884
18972
|
|
|
18885
18973
|
> `optional` **local?**: `string`
|
|
18886
18974
|
|
|
18887
|
-
Defined in: [lib/undici.ts:
|
|
18975
|
+
Defined in: [lib/undici.ts:809](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L809)
|
|
18888
18976
|
|
|
18889
18977
|
***
|
|
18890
18978
|
|
|
@@ -18892,7 +18980,7 @@ Defined in: [lib/undici.ts:786](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18892
18980
|
|
|
18893
18981
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18894
18982
|
|
|
18895
|
-
Defined in: [lib/undici.ts:
|
|
18983
|
+
Defined in: [lib/undici.ts:814](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L814)
|
|
18896
18984
|
|
|
18897
18985
|
默认为 default
|
|
18898
18986
|
|
|
@@ -18902,7 +18990,7 @@ Defined in: [lib/undici.ts:791](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18902
18990
|
|
|
18903
18991
|
> `optional` **timeout?**: `number`
|
|
18904
18992
|
|
|
18905
|
-
Defined in: [lib/undici.ts:
|
|
18993
|
+
Defined in: [lib/undici.ts:805](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L805)
|
|
18906
18994
|
|
|
18907
18995
|
秒数,默认 300 秒
|
|
18908
18996
|
|
|
@@ -18917,7 +19005,7 @@ lib/undici/interfaces/IRequestOptions.md
|
|
|
18917
19005
|
|
|
18918
19006
|
# Interface: IRequestOptions
|
|
18919
19007
|
|
|
18920
|
-
Defined in: [lib/undici.ts:
|
|
19008
|
+
Defined in: [lib/undici.ts:770](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L770)
|
|
18921
19009
|
|
|
18922
19010
|
请求的传入参数选项
|
|
18923
19011
|
|
|
@@ -18927,7 +19015,7 @@ Defined in: [lib/undici.ts:747](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18927
19015
|
|
|
18928
19016
|
> `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
|
|
18929
19017
|
|
|
18930
|
-
Defined in: [lib/undici.ts:
|
|
19018
|
+
Defined in: [lib/undici.ts:795](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L795)
|
|
18931
19019
|
|
|
18932
19020
|
cookie 托管对象
|
|
18933
19021
|
|
|
@@ -18937,7 +19025,7 @@ cookie 托管对象
|
|
|
18937
19025
|
|
|
18938
19026
|
> `optional` **follow?**: `number`
|
|
18939
19027
|
|
|
18940
|
-
Defined in: [lib/undici.ts:
|
|
19028
|
+
Defined in: [lib/undici.ts:776](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L776)
|
|
18941
19029
|
|
|
18942
19030
|
追踪 location 次数,0 为不追踪,默认为 0
|
|
18943
19031
|
|
|
@@ -18947,7 +19035,7 @@ Defined in: [lib/undici.ts:753](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18947
19035
|
|
|
18948
19036
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18949
19037
|
|
|
18950
|
-
Defined in: [lib/undici.ts:
|
|
19038
|
+
Defined in: [lib/undici.ts:781](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L781)
|
|
18951
19039
|
|
|
18952
19040
|
***
|
|
18953
19041
|
|
|
@@ -18955,7 +19043,7 @@ Defined in: [lib/undici.ts:758](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18955
19043
|
|
|
18956
19044
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18957
19045
|
|
|
18958
|
-
Defined in: [lib/undici.ts:
|
|
19046
|
+
Defined in: [lib/undici.ts:778](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L778)
|
|
18959
19047
|
|
|
18960
19048
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18961
19049
|
|
|
@@ -18965,7 +19053,7 @@ Defined in: [lib/undici.ts:755](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18965
19053
|
|
|
18966
19054
|
> `optional` **keep?**: `boolean`
|
|
18967
19055
|
|
|
18968
|
-
Defined in: [lib/undici.ts:
|
|
19056
|
+
Defined in: [lib/undici.ts:791](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L791)
|
|
18969
19057
|
|
|
18970
19058
|
连接是否保持长连接(即是否允许复用),默认为 true
|
|
18971
19059
|
|
|
@@ -18975,7 +19063,7 @@ Defined in: [lib/undici.ts:768](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18975
19063
|
|
|
18976
19064
|
> `optional` **local?**: `string`
|
|
18977
19065
|
|
|
18978
|
-
Defined in: [lib/undici.ts:
|
|
19066
|
+
Defined in: [lib/undici.ts:780](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L780)
|
|
18979
19067
|
|
|
18980
19068
|
***
|
|
18981
19069
|
|
|
@@ -18983,7 +19071,7 @@ Defined in: [lib/undici.ts:757](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18983
19071
|
|
|
18984
19072
|
> `optional` **log?**: `boolean`
|
|
18985
19073
|
|
|
18986
|
-
Defined in: [lib/undici.ts:
|
|
19074
|
+
Defined in: [lib/undici.ts:797](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L797)
|
|
18987
19075
|
|
|
18988
19076
|
若有异常写入文件日志,默认为 true
|
|
18989
19077
|
|
|
@@ -18993,7 +19081,7 @@ Defined in: [lib/undici.ts:774](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18993
19081
|
|
|
18994
19082
|
> `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
|
|
18995
19083
|
|
|
18996
|
-
Defined in: [lib/undici.ts:
|
|
19084
|
+
Defined in: [lib/undici.ts:771](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L771)
|
|
18997
19085
|
|
|
18998
19086
|
***
|
|
18999
19087
|
|
|
@@ -19001,7 +19089,7 @@ Defined in: [lib/undici.ts:748](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19001
19089
|
|
|
19002
19090
|
> `optional` **mproxy?**: `object`
|
|
19003
19091
|
|
|
19004
|
-
Defined in: [lib/undici.ts:
|
|
19092
|
+
Defined in: [lib/undici.ts:783](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L783)
|
|
19005
19093
|
|
|
19006
19094
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
19007
19095
|
|
|
@@ -19029,7 +19117,7 @@ Defined in: [lib/undici.ts:760](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19029
19117
|
|
|
19030
19118
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
19031
19119
|
|
|
19032
|
-
Defined in: [lib/undici.ts:
|
|
19120
|
+
Defined in: [lib/undici.ts:793](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L793)
|
|
19033
19121
|
|
|
19034
19122
|
复用池名/Agent,默认为 default
|
|
19035
19123
|
|
|
@@ -19039,7 +19127,7 @@ Defined in: [lib/undici.ts:770](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19039
19127
|
|
|
19040
19128
|
> `optional` **save?**: `string`
|
|
19041
19129
|
|
|
19042
|
-
Defined in: [lib/undici.ts:
|
|
19130
|
+
Defined in: [lib/undici.ts:779](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L779)
|
|
19043
19131
|
|
|
19044
19132
|
***
|
|
19045
19133
|
|
|
@@ -19047,7 +19135,7 @@ Defined in: [lib/undici.ts:756](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19047
19135
|
|
|
19048
19136
|
> `optional` **signal?**: `AbortSignal`
|
|
19049
19137
|
|
|
19050
|
-
Defined in: [lib/undici.ts:
|
|
19138
|
+
Defined in: [lib/undici.ts:799](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L799)
|
|
19051
19139
|
|
|
19052
19140
|
请求中止信号
|
|
19053
19141
|
|
|
@@ -19057,7 +19145,7 @@ Defined in: [lib/undici.ts:776](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19057
19145
|
|
|
19058
19146
|
> `optional` **timeout?**: `number`
|
|
19059
19147
|
|
|
19060
|
-
Defined in: [lib/undici.ts:
|
|
19148
|
+
Defined in: [lib/undici.ts:774](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L774)
|
|
19061
19149
|
|
|
19062
19150
|
秒数,默认 300 秒
|
|
19063
19151
|
|
|
@@ -19067,7 +19155,7 @@ Defined in: [lib/undici.ts:751](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19067
19155
|
|
|
19068
19156
|
> `optional` **type?**: `"form"` \| `"json"`
|
|
19069
19157
|
|
|
19070
|
-
Defined in: [lib/undici.ts:
|
|
19158
|
+
Defined in: [lib/undici.ts:772](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L772)
|
|
19071
19159
|
|
|
19072
19160
|
lib/undici/interfaces/IRproxyOptions.md
|
|
19073
19161
|
---
|
|
@@ -19080,7 +19168,7 @@ lib/undici/interfaces/IRproxyOptions.md
|
|
|
19080
19168
|
|
|
19081
19169
|
# Interface: IRproxyOptions
|
|
19082
19170
|
|
|
19083
|
-
Defined in: [lib/undici.ts:
|
|
19171
|
+
Defined in: [lib/undici.ts:818](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L818)
|
|
19084
19172
|
|
|
19085
19173
|
反向代理请求的传入参数选项
|
|
19086
19174
|
|
|
@@ -19090,7 +19178,7 @@ Defined in: [lib/undici.ts:795](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19090
19178
|
|
|
19091
19179
|
> `optional` **body?**: `string` \| `Buffer`\<`ArrayBufferLike`\> \| `Readable`
|
|
19092
19180
|
|
|
19093
|
-
Defined in: [lib/undici.ts:
|
|
19181
|
+
Defined in: [lib/undici.ts:837](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L837)
|
|
19094
19182
|
|
|
19095
19183
|
手动传入请求体(优先于原始 req 流),用于 req 流已消费后仍需转发 body 的场景
|
|
19096
19184
|
|
|
@@ -19100,7 +19188,7 @@ Defined in: [lib/undici.ts:814](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19100
19188
|
|
|
19101
19189
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
19102
19190
|
|
|
19103
|
-
Defined in: [lib/undici.ts:
|
|
19191
|
+
Defined in: [lib/undici.ts:827](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L827)
|
|
19104
19192
|
|
|
19105
19193
|
过滤 header,返回 true 则留下
|
|
19106
19194
|
|
|
@@ -19120,7 +19208,7 @@ Defined in: [lib/undici.ts:804](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19120
19208
|
|
|
19121
19209
|
> `optional` **follow?**: `number`
|
|
19122
19210
|
|
|
19123
|
-
Defined in: [lib/undici.ts:
|
|
19211
|
+
Defined in: [lib/undici.ts:821](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L821)
|
|
19124
19212
|
|
|
19125
19213
|
***
|
|
19126
19214
|
|
|
@@ -19128,7 +19216,7 @@ Defined in: [lib/undici.ts:798](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19128
19216
|
|
|
19129
19217
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
19130
19218
|
|
|
19131
|
-
Defined in: [lib/undici.ts:
|
|
19219
|
+
Defined in: [lib/undici.ts:825](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L825)
|
|
19132
19220
|
|
|
19133
19221
|
***
|
|
19134
19222
|
|
|
@@ -19136,7 +19224,7 @@ Defined in: [lib/undici.ts:802](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19136
19224
|
|
|
19137
19225
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
19138
19226
|
|
|
19139
|
-
Defined in: [lib/undici.ts:
|
|
19227
|
+
Defined in: [lib/undici.ts:823](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L823)
|
|
19140
19228
|
|
|
19141
19229
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
19142
19230
|
|
|
@@ -19146,7 +19234,7 @@ Defined in: [lib/undici.ts:800](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19146
19234
|
|
|
19147
19235
|
> `optional` **local?**: `string`
|
|
19148
19236
|
|
|
19149
|
-
Defined in: [lib/undici.ts:
|
|
19237
|
+
Defined in: [lib/undici.ts:824](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L824)
|
|
19150
19238
|
|
|
19151
19239
|
***
|
|
19152
19240
|
|
|
@@ -19154,7 +19242,7 @@ Defined in: [lib/undici.ts:801](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19154
19242
|
|
|
19155
19243
|
> `optional` **mproxy?**: `object`
|
|
19156
19244
|
|
|
19157
|
-
Defined in: [lib/undici.ts:
|
|
19245
|
+
Defined in: [lib/undici.ts:829](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L829)
|
|
19158
19246
|
|
|
19159
19247
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
19160
19248
|
|
|
@@ -19182,7 +19270,7 @@ Defined in: [lib/undici.ts:806](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19182
19270
|
|
|
19183
19271
|
> `optional` **querys?**: `Record`\<`string`, `any`\>
|
|
19184
19272
|
|
|
19185
|
-
Defined in: [lib/undici.ts:
|
|
19273
|
+
Defined in: [lib/undici.ts:839](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L839)
|
|
19186
19274
|
|
|
19187
19275
|
自定义 GET 查询参数,传入后直接替换代理目标 URL 的整个 query string
|
|
19188
19276
|
|
|
@@ -19192,7 +19280,7 @@ Defined in: [lib/undici.ts:816](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19192
19280
|
|
|
19193
19281
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
19194
19282
|
|
|
19195
|
-
Defined in: [lib/undici.ts:
|
|
19283
|
+
Defined in: [lib/undici.ts:841](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L841)
|
|
19196
19284
|
|
|
19197
19285
|
默认为 default
|
|
19198
19286
|
|
|
@@ -19202,7 +19290,7 @@ Defined in: [lib/undici.ts:818](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19202
19290
|
|
|
19203
19291
|
> `optional` **timeout?**: `number`
|
|
19204
19292
|
|
|
19205
|
-
Defined in: [lib/undici.ts:
|
|
19293
|
+
Defined in: [lib/undici.ts:820](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L820)
|
|
19206
19294
|
|
|
19207
19295
|
秒数,默认 300 秒
|
|
19208
19296
|
|
|
@@ -19691,7 +19779,7 @@ lib/undici/type-aliases/THttpHeaders.md
|
|
|
19691
19779
|
|
|
19692
19780
|
> **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
|
|
19693
19781
|
|
|
19694
|
-
Defined in: [lib/undici.ts:
|
|
19782
|
+
Defined in: [lib/undici.ts:846](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L846)
|
|
19695
19783
|
|
|
19696
19784
|
http headers
|
|
19697
19785
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '9.13.
|
|
9
|
+
export const VER = '9.13.7';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/net.d.ts
CHANGED
|
@@ -48,6 +48,14 @@ export declare function postJson(u: string, data: kebab.Json[] | Record<string,
|
|
|
48
48
|
* @returns JSON 数据,失败时返回 null
|
|
49
49
|
*/
|
|
50
50
|
export declare function postJsonResponseJson(u: string, data: kebab.Json[] | Record<string, kebab.Json>, opt?: IRequestOptions): Promise<kebab.Json | null>;
|
|
51
|
+
/**
|
|
52
|
+
* --- 发起 POST 请求并解析 JSON 响应 ---
|
|
53
|
+
* @param u 网址
|
|
54
|
+
* @param data 数据
|
|
55
|
+
* @param opt 选项
|
|
56
|
+
* @returns JSON 数据,失败时返回 null
|
|
57
|
+
*/
|
|
58
|
+
export declare function postResponseJson(u: string, data: Record<string, kebab.Json>, opt?: IRequestOptions): Promise<kebab.Json | null>;
|
|
51
59
|
/**
|
|
52
60
|
* --- 发起 GET 请求并解析 JSON 响应 ---
|
|
53
61
|
* @param u 网址
|
package/lib/net.js
CHANGED
|
@@ -97,6 +97,26 @@ export async function postJsonResponseJson(u, data, opt = {}) {
|
|
|
97
97
|
}
|
|
98
98
|
return json;
|
|
99
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* --- 发起 POST 请求并解析 JSON 响应 ---
|
|
102
|
+
* @param u 网址
|
|
103
|
+
* @param data 数据
|
|
104
|
+
* @param opt 选项
|
|
105
|
+
* @returns JSON 数据,失败时返回 null
|
|
106
|
+
*/
|
|
107
|
+
export async function postResponseJson(u, data, opt = {}) {
|
|
108
|
+
opt.method = 'POST';
|
|
109
|
+
const res = await request(u, data, opt);
|
|
110
|
+
const rtn = await res.getContent();
|
|
111
|
+
if (!rtn) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const json = lText.parseJson(rtn.toString());
|
|
115
|
+
if (!json) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return json;
|
|
119
|
+
}
|
|
100
120
|
/**
|
|
101
121
|
* --- 发起 GET 请求并解析 JSON 响应 ---
|
|
102
122
|
* @param u 网址
|
package/lib/undici.d.ts
CHANGED
|
@@ -42,6 +42,14 @@ export declare function postJson(u: string, data: kebab.Json[] | Record<string,
|
|
|
42
42
|
* @param opt 选项
|
|
43
43
|
*/
|
|
44
44
|
export declare function postJsonResponseJson(u: string, data: kebab.Json[] | Record<string, kebab.Json>, opt?: IRequestOptions): Promise<kebab.Json | null>;
|
|
45
|
+
/**
|
|
46
|
+
* --- 发起 POST 请求并解析 JSON 响应 ---
|
|
47
|
+
* @param u 网址
|
|
48
|
+
* @param data 数据
|
|
49
|
+
* @param opt 选项
|
|
50
|
+
* @returns JSON 数据,失败时返回 null
|
|
51
|
+
*/
|
|
52
|
+
export declare function postResponseJson(u: string, data: Record<string, kebab.Json>, opt?: IRequestOptions): Promise<kebab.Json | null>;
|
|
45
53
|
/**
|
|
46
54
|
* --- 发起 GET 请求并解析 JSON 响应 ---
|
|
47
55
|
* @param u 网址
|
package/lib/undici.js
CHANGED
|
@@ -115,6 +115,26 @@ export async function postJsonResponseJson(u, data, opt = {}) {
|
|
|
115
115
|
}
|
|
116
116
|
return json;
|
|
117
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* --- 发起 POST 请求并解析 JSON 响应 ---
|
|
120
|
+
* @param u 网址
|
|
121
|
+
* @param data 数据
|
|
122
|
+
* @param opt 选项
|
|
123
|
+
* @returns JSON 数据,失败时返回 null
|
|
124
|
+
*/
|
|
125
|
+
export async function postResponseJson(u, data, opt = {}) {
|
|
126
|
+
opt.method = 'POST';
|
|
127
|
+
const res = await request(u, data, opt);
|
|
128
|
+
const rtn = await res.getContent();
|
|
129
|
+
if (!rtn) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
const json = lText.parseJson(rtn.toString());
|
|
133
|
+
if (!json) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
return json;
|
|
137
|
+
}
|
|
118
138
|
/**
|
|
119
139
|
* --- 发起 GET 请求并解析 JSON 响应 ---
|
|
120
140
|
* @param u 网址
|