@certd/basic 1.38.9 → 1.38.11
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/CHANGELOG.md +10 -0
- package/build.md +1 -1
- package/dist/utils/util.request.js +25 -1
- package/logs/app.log +336 -0
- package/package.json +2 -2
- package/test.mjs +15 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @certd/basic
|
|
9
|
+
|
|
10
|
+
## [1.38.10](https://github.com/certd/certd/compare/v1.38.9...v1.38.10) (2026-02-15)
|
|
11
|
+
|
|
12
|
+
### Performance Improvements
|
|
13
|
+
|
|
14
|
+
* 421 支持3次重试 ([b91548e](https://github.com/certd/certd/commit/b91548eef4c24faa822d3a40f1f6a77b41d274e4))
|
|
15
|
+
|
|
6
16
|
## [1.38.9](https://github.com/certd/certd/compare/v1.38.8...v1.38.9) (2026-02-09)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
package/build.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
23:
|
|
1
|
+
23:40
|
|
@@ -7,6 +7,7 @@ import * as https from "node:https";
|
|
|
7
7
|
import { merge } from "lodash-es";
|
|
8
8
|
import { safePromise } from "./util.promise.js";
|
|
9
9
|
import fs from "fs";
|
|
10
|
+
import sleep from "./util.sleep.js";
|
|
10
11
|
const errorMap = {
|
|
11
12
|
"ssl3_get_record:wrong version number": "http协议错误,服务端要求http协议,请检查是否使用了https请求",
|
|
12
13
|
"getaddrinfo EAI_AGAIN": "无法解析域名,请检查网络连接或dns配置,更换docker-compose.yaml中dns配置",
|
|
@@ -129,6 +130,12 @@ export function createAxiosService({ logger }) {
|
|
|
129
130
|
// });
|
|
130
131
|
// config.httpsAgent = agent;
|
|
131
132
|
config.proxy = false; //必须 否则还会走一层代理,
|
|
133
|
+
config.retry = merge({
|
|
134
|
+
status: [421],
|
|
135
|
+
count: 0,
|
|
136
|
+
max: 3,
|
|
137
|
+
delay: 1000,
|
|
138
|
+
}, config.retry);
|
|
132
139
|
return config;
|
|
133
140
|
}, (error) => {
|
|
134
141
|
// 发送失败
|
|
@@ -152,7 +159,7 @@ export function createAxiosService({ logger }) {
|
|
|
152
159
|
return response;
|
|
153
160
|
}
|
|
154
161
|
return response.data;
|
|
155
|
-
}, (error) => {
|
|
162
|
+
}, async (error) => {
|
|
156
163
|
const status = error.response?.status;
|
|
157
164
|
let message = "";
|
|
158
165
|
switch (status) {
|
|
@@ -192,6 +199,9 @@ export function createAxiosService({ logger }) {
|
|
|
192
199
|
case 302:
|
|
193
200
|
//重定向
|
|
194
201
|
return Promise.resolve(error.response);
|
|
202
|
+
case 421:
|
|
203
|
+
message = "源站请求超时";
|
|
204
|
+
break;
|
|
195
205
|
default:
|
|
196
206
|
break;
|
|
197
207
|
}
|
|
@@ -236,6 +246,20 @@ export function createAxiosService({ logger }) {
|
|
|
236
246
|
if (error instanceof AggregateError) {
|
|
237
247
|
logger.error("AggregateError", error);
|
|
238
248
|
}
|
|
249
|
+
const originalRequest = error.config || {};
|
|
250
|
+
logger.info(`config`, originalRequest);
|
|
251
|
+
const retry = originalRequest.retry || {};
|
|
252
|
+
if (retry.status && retry.status.includes(status)) {
|
|
253
|
+
if (retry.max > 0 && retry.count < retry.max) {
|
|
254
|
+
// 重试次数增加
|
|
255
|
+
retry.count++;
|
|
256
|
+
const delay = retry.delay * retry.count;
|
|
257
|
+
logger.error(`status=${status},重试次数${retry.count},将在${delay}ms后重试,请求地址:${originalRequest.url}`);
|
|
258
|
+
await sleep(delay);
|
|
259
|
+
return service.request(originalRequest); // 重试请求
|
|
260
|
+
}
|
|
261
|
+
logger.error(`重试超过最大次数${retry.max},请求失败:${originalRequest.url}`);
|
|
262
|
+
}
|
|
239
263
|
const err = new HttpError(error);
|
|
240
264
|
if (error.response?.config?.logParams === false) {
|
|
241
265
|
delete err.request?.params;
|
package/logs/app.log
ADDED
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
[2026-02-13T18:51:51.247] [INFO] default - http request:https://www.baidu.com,method:get
|
|
2
|
+
[2026-02-13T18:51:51.538] [INFO] default - http response status: 200
|
|
3
|
+
[2026-02-13T18:52:12.970] [INFO] default - http request:https://www.baidu1.com,method:get
|
|
4
|
+
[2026-02-13T18:52:34.122] [ERROR] default - 请求出错:请求连接超时 [ETIMEDOUT] (connect ETIMEDOUT 103.233.82.15:443) status:undefined,statusText:ETIMEDOUT,url:https://www.baidu1.com,method:get。
|
|
5
|
+
[2026-02-13T18:52:52.961] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
6
|
+
[2026-02-13T18:52:53.224] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
7
|
+
[2026-02-13T18:53:03.327] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
8
|
+
[2026-02-13T18:53:03.598] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
9
|
+
[2026-02-13T18:53:50.941] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
10
|
+
[2026-02-13T18:53:51.212] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
11
|
+
[2026-02-13T18:54:02.933] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
12
|
+
[2026-02-13T18:54:03.107] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
13
|
+
[2026-02-13T18:57:14.324] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
14
|
+
[2026-02-13T18:57:14.592] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
15
|
+
[2026-02-13T18:58:06.730] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
16
|
+
[2026-02-13T18:58:06.909] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
17
|
+
[2026-02-13T18:58:21.674] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
18
|
+
[2026-02-13T18:58:21.933] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
19
|
+
[2026-02-13T18:58:44.137] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
20
|
+
[2026-02-13T18:58:44.381] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
21
|
+
[2026-02-13T18:59:18.633] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
22
|
+
[2026-02-13T18:59:18.853] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
23
|
+
[2026-02-13T18:59:31.223] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
24
|
+
[2026-02-13T18:59:31.444] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
25
|
+
[2026-02-13T18:59:41.552] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
26
|
+
[2026-02-13T18:59:41.761] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
27
|
+
[2026-02-13T19:01:17.755] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
28
|
+
[2026-02-13T19:01:17.992] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
29
|
+
[2026-02-13T19:01:39.779] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
30
|
+
[2026-02-13T19:01:40.039] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
31
|
+
[2026-02-13T19:01:40.040] [ERROR] default - 返回数据: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL /234234/3333 was not found on this server.</p>\n</body></html>\n"
|
|
32
|
+
[2026-02-13T19:01:40.040] [INFO] default - config {
|
|
33
|
+
transitional: {
|
|
34
|
+
silentJSONParsing: true,
|
|
35
|
+
forcedJSONParsing: true,
|
|
36
|
+
clarifyTimeoutError: false
|
|
37
|
+
},
|
|
38
|
+
adapter: [ 'xhr', 'http', 'fetch' ],
|
|
39
|
+
transformRequest: [ [Function: transformRequest] ],
|
|
40
|
+
transformResponse: [ [Function: transformResponse] ],
|
|
41
|
+
timeout: 0,
|
|
42
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
43
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
44
|
+
maxContentLength: -1,
|
|
45
|
+
maxBodyLength: -1,
|
|
46
|
+
env: {
|
|
47
|
+
FormData: [Function: FormData] [FormData] {
|
|
48
|
+
LINE_BREAK: '\r\n',
|
|
49
|
+
DEFAULT_CONTENT_TYPE: 'application/octet-stream'
|
|
50
|
+
},
|
|
51
|
+
Blob: [class Blob]
|
|
52
|
+
},
|
|
53
|
+
validateStatus: [Function: validateStatus],
|
|
54
|
+
headers: Object [AxiosHeaders] {
|
|
55
|
+
Accept: 'application/json, text/plain, */*',
|
|
56
|
+
'Content-Type': undefined,
|
|
57
|
+
'User-Agent': 'axios/1.9.0',
|
|
58
|
+
'Accept-Encoding': 'gzip, compress, deflate, br'
|
|
59
|
+
},
|
|
60
|
+
url: 'https://www.baidu.com/234234/3333',
|
|
61
|
+
retry: { status: [ 404 ], count: 0, max: 3, delay: 1000 },
|
|
62
|
+
allowAbsoluteUrls: true,
|
|
63
|
+
method: 'get',
|
|
64
|
+
logParams: false,
|
|
65
|
+
logRes: false,
|
|
66
|
+
logData: false,
|
|
67
|
+
httpsAgent: Agent {
|
|
68
|
+
_events: [Object: null prototype] {
|
|
69
|
+
free: [Function (anonymous)],
|
|
70
|
+
newListener: [Function: maybeEnableKeylog]
|
|
71
|
+
},
|
|
72
|
+
_eventsCount: 2,
|
|
73
|
+
_maxListeners: undefined,
|
|
74
|
+
defaultPort: 443,
|
|
75
|
+
protocol: 'https:',
|
|
76
|
+
options: [Object: null prototype] {
|
|
77
|
+
autoSelectFamily: true,
|
|
78
|
+
autoSelectFamilyAttemptTimeout: 1000,
|
|
79
|
+
noDelay: true,
|
|
80
|
+
path: null
|
|
81
|
+
},
|
|
82
|
+
requests: [Object: null prototype] {},
|
|
83
|
+
sockets: [Object: null prototype] {
|
|
84
|
+
'www.baidu.com:443:::::::::::::::::::::': [Array]
|
|
85
|
+
},
|
|
86
|
+
freeSockets: [Object: null prototype] {},
|
|
87
|
+
keepAliveMsecs: 1000,
|
|
88
|
+
keepAlive: false,
|
|
89
|
+
maxSockets: Infinity,
|
|
90
|
+
maxFreeSockets: 256,
|
|
91
|
+
scheduling: 'lifo',
|
|
92
|
+
maxTotalSockets: Infinity,
|
|
93
|
+
totalSocketCount: 1,
|
|
94
|
+
maxCachedSessions: 100,
|
|
95
|
+
_sessionCache: { map: [Object], list: [Array] },
|
|
96
|
+
[Symbol(shapeMode)]: false,
|
|
97
|
+
[Symbol(kCapture)]: false
|
|
98
|
+
},
|
|
99
|
+
httpAgent: Agent {
|
|
100
|
+
_events: [Object: null prototype] {
|
|
101
|
+
free: [Function (anonymous)],
|
|
102
|
+
newListener: [Function: maybeEnableKeylog]
|
|
103
|
+
},
|
|
104
|
+
_eventsCount: 2,
|
|
105
|
+
_maxListeners: undefined,
|
|
106
|
+
defaultPort: 80,
|
|
107
|
+
protocol: 'http:',
|
|
108
|
+
options: [Object: null prototype] {
|
|
109
|
+
autoSelectFamily: true,
|
|
110
|
+
autoSelectFamilyAttemptTimeout: 1000,
|
|
111
|
+
noDelay: true,
|
|
112
|
+
path: null
|
|
113
|
+
},
|
|
114
|
+
requests: [Object: null prototype] {},
|
|
115
|
+
sockets: [Object: null prototype] {},
|
|
116
|
+
freeSockets: [Object: null prototype] {},
|
|
117
|
+
keepAliveMsecs: 1000,
|
|
118
|
+
keepAlive: false,
|
|
119
|
+
maxSockets: Infinity,
|
|
120
|
+
maxFreeSockets: 256,
|
|
121
|
+
scheduling: 'lifo',
|
|
122
|
+
maxTotalSockets: Infinity,
|
|
123
|
+
totalSocketCount: 0,
|
|
124
|
+
[Symbol(shapeMode)]: false,
|
|
125
|
+
[Symbol(kCapture)]: false
|
|
126
|
+
},
|
|
127
|
+
proxy: false,
|
|
128
|
+
data: undefined
|
|
129
|
+
}
|
|
130
|
+
[2026-02-13T19:01:40.042] [ERROR] default - status=404,重试次数1,将在1000ms后重试,请求地址:https://www.baidu.com/234234/3333
|
|
131
|
+
[2026-02-13T19:01:41.049] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
132
|
+
[2026-02-13T19:01:41.163] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
133
|
+
[2026-02-13T19:01:41.163] [ERROR] default - 返回数据: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL /234234/3333 was not found on this server.</p>\n</body></html>\n"
|
|
134
|
+
[2026-02-13T19:01:41.163] [INFO] default - config {
|
|
135
|
+
transitional: {
|
|
136
|
+
silentJSONParsing: true,
|
|
137
|
+
forcedJSONParsing: true,
|
|
138
|
+
clarifyTimeoutError: false
|
|
139
|
+
},
|
|
140
|
+
adapter: [ 'xhr', 'http', 'fetch' ],
|
|
141
|
+
transformRequest: [ [Function: transformRequest] ],
|
|
142
|
+
transformResponse: [ [Function: transformResponse] ],
|
|
143
|
+
timeout: 0,
|
|
144
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
145
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
146
|
+
maxContentLength: -1,
|
|
147
|
+
maxBodyLength: -1,
|
|
148
|
+
env: {
|
|
149
|
+
FormData: [Function: FormData] [FormData] {
|
|
150
|
+
LINE_BREAK: '\r\n',
|
|
151
|
+
DEFAULT_CONTENT_TYPE: 'application/octet-stream'
|
|
152
|
+
},
|
|
153
|
+
Blob: [class Blob]
|
|
154
|
+
},
|
|
155
|
+
validateStatus: [Function: validateStatus],
|
|
156
|
+
headers: Object [AxiosHeaders] {
|
|
157
|
+
Accept: 'application/json, text/plain, */*',
|
|
158
|
+
'Content-Type': undefined,
|
|
159
|
+
'User-Agent': 'axios/1.9.0',
|
|
160
|
+
'Accept-Encoding': 'gzip, compress, deflate, br'
|
|
161
|
+
},
|
|
162
|
+
url: 'https://www.baidu.com/234234/3333',
|
|
163
|
+
retry: { status: [ 404 ], count: 1, max: 3, delay: 1000 },
|
|
164
|
+
allowAbsoluteUrls: true,
|
|
165
|
+
method: 'get',
|
|
166
|
+
logParams: false,
|
|
167
|
+
logRes: false,
|
|
168
|
+
logData: false,
|
|
169
|
+
httpsAgent: Agent {
|
|
170
|
+
_events: [Object: null prototype] {
|
|
171
|
+
free: [Function (anonymous)],
|
|
172
|
+
newListener: [Function: maybeEnableKeylog]
|
|
173
|
+
},
|
|
174
|
+
_eventsCount: 2,
|
|
175
|
+
_maxListeners: undefined,
|
|
176
|
+
defaultPort: 443,
|
|
177
|
+
protocol: 'https:',
|
|
178
|
+
options: [Object: null prototype] {
|
|
179
|
+
autoSelectFamily: true,
|
|
180
|
+
autoSelectFamilyAttemptTimeout: 1000,
|
|
181
|
+
noDelay: true,
|
|
182
|
+
path: null
|
|
183
|
+
},
|
|
184
|
+
requests: [Object: null prototype] {},
|
|
185
|
+
sockets: [Object: null prototype] {
|
|
186
|
+
'www.baidu.com:443:::::::::::::::::::::': [Array]
|
|
187
|
+
},
|
|
188
|
+
freeSockets: [Object: null prototype] {},
|
|
189
|
+
keepAliveMsecs: 1000,
|
|
190
|
+
keepAlive: false,
|
|
191
|
+
maxSockets: Infinity,
|
|
192
|
+
maxFreeSockets: 256,
|
|
193
|
+
scheduling: 'lifo',
|
|
194
|
+
maxTotalSockets: Infinity,
|
|
195
|
+
totalSocketCount: 1,
|
|
196
|
+
maxCachedSessions: 100,
|
|
197
|
+
_sessionCache: { map: [Object], list: [Array] },
|
|
198
|
+
[Symbol(shapeMode)]: false,
|
|
199
|
+
[Symbol(kCapture)]: false
|
|
200
|
+
},
|
|
201
|
+
httpAgent: Agent {
|
|
202
|
+
_events: [Object: null prototype] {
|
|
203
|
+
free: [Function (anonymous)],
|
|
204
|
+
newListener: [Function: maybeEnableKeylog]
|
|
205
|
+
},
|
|
206
|
+
_eventsCount: 2,
|
|
207
|
+
_maxListeners: undefined,
|
|
208
|
+
defaultPort: 80,
|
|
209
|
+
protocol: 'http:',
|
|
210
|
+
options: [Object: null prototype] {
|
|
211
|
+
autoSelectFamily: true,
|
|
212
|
+
autoSelectFamilyAttemptTimeout: 1000,
|
|
213
|
+
noDelay: true,
|
|
214
|
+
path: null
|
|
215
|
+
},
|
|
216
|
+
requests: [Object: null prototype] {},
|
|
217
|
+
sockets: [Object: null prototype] {},
|
|
218
|
+
freeSockets: [Object: null prototype] {},
|
|
219
|
+
keepAliveMsecs: 1000,
|
|
220
|
+
keepAlive: false,
|
|
221
|
+
maxSockets: Infinity,
|
|
222
|
+
maxFreeSockets: 256,
|
|
223
|
+
scheduling: 'lifo',
|
|
224
|
+
maxTotalSockets: Infinity,
|
|
225
|
+
totalSocketCount: 0,
|
|
226
|
+
[Symbol(shapeMode)]: false,
|
|
227
|
+
[Symbol(kCapture)]: false
|
|
228
|
+
},
|
|
229
|
+
proxy: false,
|
|
230
|
+
data: undefined
|
|
231
|
+
}
|
|
232
|
+
[2026-02-13T19:01:41.164] [ERROR] default - status=404,重试次数2,将在2000ms后重试,请求地址:https://www.baidu.com/234234/3333
|
|
233
|
+
[2026-02-13T19:01:43.180] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
234
|
+
[2026-02-13T19:01:43.289] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
|
235
|
+
[2026-02-13T19:01:43.289] [ERROR] default - 返回数据: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL /234234/3333 was not found on this server.</p>\n</body></html>\n"
|
|
236
|
+
[2026-02-13T19:01:43.289] [INFO] default - config {
|
|
237
|
+
transitional: {
|
|
238
|
+
silentJSONParsing: true,
|
|
239
|
+
forcedJSONParsing: true,
|
|
240
|
+
clarifyTimeoutError: false
|
|
241
|
+
},
|
|
242
|
+
adapter: [ 'xhr', 'http', 'fetch' ],
|
|
243
|
+
transformRequest: [ [Function: transformRequest] ],
|
|
244
|
+
transformResponse: [ [Function: transformResponse] ],
|
|
245
|
+
timeout: 0,
|
|
246
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
247
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
248
|
+
maxContentLength: -1,
|
|
249
|
+
maxBodyLength: -1,
|
|
250
|
+
env: {
|
|
251
|
+
FormData: [Function: FormData] [FormData] {
|
|
252
|
+
LINE_BREAK: '\r\n',
|
|
253
|
+
DEFAULT_CONTENT_TYPE: 'application/octet-stream'
|
|
254
|
+
},
|
|
255
|
+
Blob: [class Blob]
|
|
256
|
+
},
|
|
257
|
+
validateStatus: [Function: validateStatus],
|
|
258
|
+
headers: Object [AxiosHeaders] {
|
|
259
|
+
Accept: 'application/json, text/plain, */*',
|
|
260
|
+
'Content-Type': undefined,
|
|
261
|
+
'User-Agent': 'axios/1.9.0',
|
|
262
|
+
'Accept-Encoding': 'gzip, compress, deflate, br'
|
|
263
|
+
},
|
|
264
|
+
url: 'https://www.baidu.com/234234/3333',
|
|
265
|
+
retry: { status: [ 404 ], count: 2, max: 3, delay: 1000 },
|
|
266
|
+
allowAbsoluteUrls: true,
|
|
267
|
+
method: 'get',
|
|
268
|
+
logParams: false,
|
|
269
|
+
logRes: false,
|
|
270
|
+
logData: false,
|
|
271
|
+
httpsAgent: Agent {
|
|
272
|
+
_events: [Object: null prototype] {
|
|
273
|
+
free: [Function (anonymous)],
|
|
274
|
+
newListener: [Function: maybeEnableKeylog]
|
|
275
|
+
},
|
|
276
|
+
_eventsCount: 2,
|
|
277
|
+
_maxListeners: undefined,
|
|
278
|
+
defaultPort: 443,
|
|
279
|
+
protocol: 'https:',
|
|
280
|
+
options: [Object: null prototype] {
|
|
281
|
+
autoSelectFamily: true,
|
|
282
|
+
autoSelectFamilyAttemptTimeout: 1000,
|
|
283
|
+
noDelay: true,
|
|
284
|
+
path: null
|
|
285
|
+
},
|
|
286
|
+
requests: [Object: null prototype] {},
|
|
287
|
+
sockets: [Object: null prototype] {
|
|
288
|
+
'www.baidu.com:443:::::::::::::::::::::': [Array]
|
|
289
|
+
},
|
|
290
|
+
freeSockets: [Object: null prototype] {},
|
|
291
|
+
keepAliveMsecs: 1000,
|
|
292
|
+
keepAlive: false,
|
|
293
|
+
maxSockets: Infinity,
|
|
294
|
+
maxFreeSockets: 256,
|
|
295
|
+
scheduling: 'lifo',
|
|
296
|
+
maxTotalSockets: Infinity,
|
|
297
|
+
totalSocketCount: 1,
|
|
298
|
+
maxCachedSessions: 100,
|
|
299
|
+
_sessionCache: { map: [Object], list: [Array] },
|
|
300
|
+
[Symbol(shapeMode)]: false,
|
|
301
|
+
[Symbol(kCapture)]: false
|
|
302
|
+
},
|
|
303
|
+
httpAgent: Agent {
|
|
304
|
+
_events: [Object: null prototype] {
|
|
305
|
+
free: [Function (anonymous)],
|
|
306
|
+
newListener: [Function: maybeEnableKeylog]
|
|
307
|
+
},
|
|
308
|
+
_eventsCount: 2,
|
|
309
|
+
_maxListeners: undefined,
|
|
310
|
+
defaultPort: 80,
|
|
311
|
+
protocol: 'http:',
|
|
312
|
+
options: [Object: null prototype] {
|
|
313
|
+
autoSelectFamily: true,
|
|
314
|
+
autoSelectFamilyAttemptTimeout: 1000,
|
|
315
|
+
noDelay: true,
|
|
316
|
+
path: null
|
|
317
|
+
},
|
|
318
|
+
requests: [Object: null prototype] {},
|
|
319
|
+
sockets: [Object: null prototype] {},
|
|
320
|
+
freeSockets: [Object: null prototype] {},
|
|
321
|
+
keepAliveMsecs: 1000,
|
|
322
|
+
keepAlive: false,
|
|
323
|
+
maxSockets: Infinity,
|
|
324
|
+
maxFreeSockets: 256,
|
|
325
|
+
scheduling: 'lifo',
|
|
326
|
+
maxTotalSockets: Infinity,
|
|
327
|
+
totalSocketCount: 0,
|
|
328
|
+
[Symbol(shapeMode)]: false,
|
|
329
|
+
[Symbol(kCapture)]: false
|
|
330
|
+
},
|
|
331
|
+
proxy: false,
|
|
332
|
+
data: undefined
|
|
333
|
+
}
|
|
334
|
+
[2026-02-13T19:01:43.290] [ERROR] default - status=404,重试次数3,将在3000ms后重试,请求地址:https://www.baidu.com/234234/3333
|
|
335
|
+
[2026-02-13T19:01:46.301] [INFO] default - http request:https://www.baidu.com/234234/3333,method:get
|
|
336
|
+
[2026-02-13T19:01:46.435] [ERROR] default - 请求出错: [ERR_BAD_REQUEST] ,请求地址出错 [404] (Request failed with status code 404) status:404,statusText:Not Found,url:https://www.baidu.com/234234/3333,method:get。
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@certd/basic",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.38.
|
|
4
|
+
"version": "1.38.11",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"tslib": "^2.8.1",
|
|
48
48
|
"typescript": "^5.4.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "1f002159e2a3c73fb5e00341a344effa07d6f653"
|
|
51
51
|
}
|
package/test.mjs
CHANGED
|
@@ -13,6 +13,19 @@
|
|
|
13
13
|
|
|
14
14
|
// await testLocker();
|
|
15
15
|
|
|
16
|
-
import { domainUtils } from "./dist/utils/util.domain.js";
|
|
16
|
+
// import { domainUtils } from "./dist/utils/util.domain.js";
|
|
17
17
|
|
|
18
|
-
console.log(domainUtils.isIpv6("::0:0:0:FFFF:129.144.52.38"));
|
|
18
|
+
// console.log(domainUtils.isIpv6("::0:0:0:FFFF:129.144.52.38"));
|
|
19
|
+
|
|
20
|
+
// import { http } from "./dist/utils/util.request.js";
|
|
21
|
+
|
|
22
|
+
// http
|
|
23
|
+
// .request({
|
|
24
|
+
// url: "https://www.baidu.com/234234/3333",
|
|
25
|
+
// retry: {
|
|
26
|
+
// status: [404],
|
|
27
|
+
// },
|
|
28
|
+
// })
|
|
29
|
+
// .then(res => {
|
|
30
|
+
// console.log(res.data);
|
|
31
|
+
// });
|