wok-server 0.7.0 → 0.7.1
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.
|
@@ -36,7 +36,8 @@ function doRequest(opts) {
|
|
|
36
36
|
method: opts.method,
|
|
37
37
|
headers: opts.headers,
|
|
38
38
|
timeout: opts.timeout && opts.timeout > 0 ? opts.timeout : 5000,
|
|
39
|
-
rejectUnauthorized: false
|
|
39
|
+
rejectUnauthorized: false,
|
|
40
|
+
agent: opts.agent
|
|
40
41
|
}, res => {
|
|
41
42
|
const chunks = [];
|
|
42
43
|
res.on('error', reject);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wok-server",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"packageManager": "pnpm@8.9.0",
|
|
5
5
|
"description": "一个基于 NodeJs 和 TypeScript 的后端框架,轻量级、克制、简洁。A lightweight, restrained, and concise backend framework based on Node.js and TypeScript.",
|
|
6
6
|
"scripts": {
|
package/src/http-client/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IncomingHttpHeaders, request as requestHttp } from 'http'
|
|
2
|
-
import { request as requestHttps } from 'https'
|
|
1
|
+
import { IncomingHttpHeaders, request as requestHttp, Agent as HttpAgent } from 'http'
|
|
2
|
+
import { request as requestHttps, Agent as HttpsAgent } from 'https'
|
|
3
3
|
import { URL } from 'url'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -34,6 +34,10 @@ export interface HttpRequestOpts {
|
|
|
34
34
|
* 是否跟随重定向
|
|
35
35
|
*/
|
|
36
36
|
followRedirect?: boolean
|
|
37
|
+
/**
|
|
38
|
+
* HTTP/HTTPS Agent,用于连接复用、代理等高级配置
|
|
39
|
+
*/
|
|
40
|
+
agent?: HttpAgent | HttpsAgent
|
|
37
41
|
}
|
|
38
42
|
/**
|
|
39
43
|
* 响应信息.
|
|
@@ -86,7 +90,8 @@ export function doRequest(opts: HttpRequestOpts): Promise<HttpResponseInfo> {
|
|
|
86
90
|
method: opts.method,
|
|
87
91
|
headers: opts.headers,
|
|
88
92
|
timeout: opts.timeout && opts.timeout > 0 ? opts.timeout : 5000,
|
|
89
|
-
rejectUnauthorized: false
|
|
93
|
+
rejectUnauthorized: false,
|
|
94
|
+
agent: opts.agent
|
|
90
95
|
},
|
|
91
96
|
res => {
|
|
92
97
|
const chunks: any[] = []
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import { IncomingHttpHeaders, Agent as HttpAgent } from 'http';
|
|
5
|
+
import { Agent as HttpsAgent } from 'https';
|
|
4
6
|
/**
|
|
5
7
|
* 请求选项.
|
|
6
8
|
*/
|
|
@@ -33,6 +35,10 @@ export interface HttpRequestOpts {
|
|
|
33
35
|
* 是否跟随重定向
|
|
34
36
|
*/
|
|
35
37
|
followRedirect?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* HTTP/HTTPS Agent,用于连接复用、代理等高级配置
|
|
40
|
+
*/
|
|
41
|
+
agent?: HttpAgent | HttpsAgent;
|
|
36
42
|
}
|
|
37
43
|
/**
|
|
38
44
|
* 响应信息.
|