mm_https 1.6.3 → 1.6.5
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/README.md +244 -220
- package/index.js +204 -171
- package/npm-publish-checklist.md +99 -0
- package/package.json +15 -13
- package/test.js +162 -209
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# mm_https模块 npm发布检查清单
|
|
2
|
+
|
|
3
|
+
## ✅ 已完成的项目
|
|
4
|
+
|
|
5
|
+
### 1. 代码重构和规范
|
|
6
|
+
- [x] 类名和方法名使用小驼峰命名法
|
|
7
|
+
- [x] 私有成员使用下划线前缀
|
|
8
|
+
- [x] 变量名使用小写蛇形命名法
|
|
9
|
+
- [x] 完整的JSDoc注释
|
|
10
|
+
- [x] 符合ES6类和原型方法范式
|
|
11
|
+
|
|
12
|
+
### 2. 测试文件优化
|
|
13
|
+
- [x] 创建适合npm发布的测试文件
|
|
14
|
+
- [x] 包含基础功能测试
|
|
15
|
+
- [x] 包含高级功能测试
|
|
16
|
+
- [x] 包含错误处理测试
|
|
17
|
+
- [x] 所有测试通过
|
|
18
|
+
|
|
19
|
+
### 3. 配置文件优化
|
|
20
|
+
- [x] 更新package.json描述和关键词
|
|
21
|
+
- [x] 添加Node.js版本要求
|
|
22
|
+
- [x] 优化依赖管理
|
|
23
|
+
|
|
24
|
+
### 4. 功能验证
|
|
25
|
+
- [x] 语法检查通过
|
|
26
|
+
- [x] 依赖关系正常
|
|
27
|
+
- [x] 模块功能完整
|
|
28
|
+
|
|
29
|
+
## 📋 npm发布前检查
|
|
30
|
+
|
|
31
|
+
### 版本管理
|
|
32
|
+
- [ ] 确认当前版本号:1.6.4
|
|
33
|
+
- [ ] 是否需要更新版本号
|
|
34
|
+
- [ ] 更新CHANGELOG.md(如有)
|
|
35
|
+
|
|
36
|
+
### 文档检查
|
|
37
|
+
- [ ] README.md内容完整且准确
|
|
38
|
+
- [ ] 示例代码正确
|
|
39
|
+
- [ ] 安装说明清晰
|
|
40
|
+
|
|
41
|
+
### 发布准备
|
|
42
|
+
- [ ] 登录npm账号:`npm login`
|
|
43
|
+
- [ ] 检查包名可用性:`npm search mm_https`
|
|
44
|
+
- [ ] 执行发布命令:`npm publish`
|
|
45
|
+
|
|
46
|
+
## 🚀 发布命令
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# 登录npm(如果未登录)
|
|
50
|
+
npm login
|
|
51
|
+
|
|
52
|
+
# 检查包名是否可用
|
|
53
|
+
npm search mm_https
|
|
54
|
+
|
|
55
|
+
# 发布到npm
|
|
56
|
+
npm publish
|
|
57
|
+
|
|
58
|
+
# 或者发布为公开包(如果需要)
|
|
59
|
+
npm publish --access public
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 📦 安装使用
|
|
63
|
+
|
|
64
|
+
发布后,用户可以通过以下方式安装:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install mm_https
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
使用示例:
|
|
71
|
+
```javascript
|
|
72
|
+
const { Http } = require('mm_https');
|
|
73
|
+
|
|
74
|
+
async function example() {
|
|
75
|
+
const http = new Http();
|
|
76
|
+
const res = await http.get('https://httpbin.org/get');
|
|
77
|
+
console.log(res.body);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## 🔧 开发命令
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# 运行测试
|
|
85
|
+
npm test
|
|
86
|
+
|
|
87
|
+
# 开发模式
|
|
88
|
+
npm run dev
|
|
89
|
+
|
|
90
|
+
# 安装依赖
|
|
91
|
+
npm install
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 📞 支持信息
|
|
95
|
+
|
|
96
|
+
- 作者:邱文武
|
|
97
|
+
- 许可证:ISC
|
|
98
|
+
- 问题反馈:https://gitee.com/qiuwenwu91/mm_https/issues
|
|
99
|
+
- 主页:https://gitee.com/qiuwenwu91/mm_https#readme
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_https",
|
|
3
|
-
"version": "1.6.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.6.5",
|
|
4
|
+
"description": "超级美眉HTTP请求模块 - 支持自动Cookie管理、代理设置、文件下载等功能",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "node test.js",
|
|
@@ -12,17 +12,16 @@
|
|
|
12
12
|
"url": "git+https://gitee.com/qiuwenwu91/mm_https.git"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
|
-
"
|
|
15
|
+
"http",
|
|
16
|
+
"https",
|
|
17
|
+
"request",
|
|
16
18
|
"async",
|
|
17
|
-
"await",
|
|
18
19
|
"promise",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"run",
|
|
25
|
-
"exec"
|
|
20
|
+
"cookie",
|
|
21
|
+
"proxy",
|
|
22
|
+
"download",
|
|
23
|
+
"nodejs",
|
|
24
|
+
"http-client"
|
|
26
25
|
],
|
|
27
26
|
"author": "邱文武",
|
|
28
27
|
"license": "ISC",
|
|
@@ -30,9 +29,12 @@
|
|
|
30
29
|
"url": "https://gitee.com/qiuwenwu91/mm_https/issues"
|
|
31
30
|
},
|
|
32
31
|
"homepage": "https://gitee.com/qiuwenwu91/mm_https#readme",
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=12.0.0"
|
|
34
|
+
},
|
|
33
35
|
"dependencies": {
|
|
34
36
|
"https-proxy-agent": "^7.0.6",
|
|
35
|
-
"iconv-lite": "^0.
|
|
36
|
-
"mm_expand": "^1.
|
|
37
|
+
"iconv-lite": "^0.7.0",
|
|
38
|
+
"mm_expand": "^1.9.7"
|
|
37
39
|
}
|
|
38
40
|
}
|
package/test.js
CHANGED
|
@@ -1,215 +1,168 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/**
|
|
2
|
+
* mm_https模块测试文件
|
|
3
|
+
* 用于npm发布前的功能验证
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
Http
|
|
8
|
+
} = require('./index.js');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 基础HTTP请求测试
|
|
12
|
+
*/
|
|
13
|
+
async function testBasicRequests() {
|
|
14
|
+
console.log('=== 基础HTTP请求测试 ===');
|
|
15
|
+
|
|
16
|
+
const http = new Http();
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
// 测试GET请求
|
|
20
|
+
console.log('1. 测试GET请求...');
|
|
21
|
+
const getRes = await http.get('https://httpbin.org/get');
|
|
22
|
+
console.log('GET请求状态码:', getRes.status);
|
|
23
|
+
console.log('GET请求成功');
|
|
24
|
+
|
|
25
|
+
// 测试POST请求
|
|
26
|
+
console.log('2. 测试POST请求...');
|
|
27
|
+
const postData = { test: 'data', value: 123 };
|
|
28
|
+
const postRes = await http.post('https://httpbin.org/post', postData);
|
|
29
|
+
console.log('POST请求状态码:', postRes.status);
|
|
30
|
+
console.log('POST请求成功');
|
|
31
|
+
|
|
32
|
+
// 测试Cookie管理
|
|
33
|
+
console.log('3. 测试Cookie管理...');
|
|
34
|
+
http.setCookie('session=test_session; user=test_user');
|
|
35
|
+
const cookieStr = http.getCookie();
|
|
36
|
+
console.log('当前Cookie:', cookieStr);
|
|
37
|
+
|
|
38
|
+
console.log('✅ 基础功能测试通过');
|
|
39
|
+
return true;
|
|
40
|
+
} catch (err) {
|
|
41
|
+
console.error('❌ 基础功能测试失败:', err.message);
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
10
44
|
}
|
|
11
45
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// },
|
|
52
|
-
// "userInfo": {
|
|
53
|
-
// "apiKey": apikey,
|
|
54
|
-
// "userId": from_user
|
|
55
|
-
// }
|
|
56
|
-
// };
|
|
57
|
-
// //http://192.168.18.199:8000/test/hello
|
|
58
|
-
// var res = await hp.post("http://openapi.tuling123.com/openapi/api/v2", pm);
|
|
59
|
-
// console.log(res.body);
|
|
60
|
-
// }
|
|
61
|
-
// test2("真的", "we21lkjq3l");
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// // 测试
|
|
65
|
-
// async function test() {
|
|
66
|
-
// var hp = new Http({
|
|
67
|
-
// proxy: "http://127.0.0.1:10809"
|
|
68
|
-
// });
|
|
69
|
-
// res = await hp.post("https://accounts.binance.com/bapi/accounts/v2/public/authcenter/login", {
|
|
70
|
-
// 'phone': "15817188815",
|
|
71
|
-
// 'password': "asd123"
|
|
72
|
-
// }, null, 'form');
|
|
73
|
-
// var token = hp.cookies['x-auth-token'];
|
|
74
|
-
// // res = await hp.get("http://api.bitcentre.com.cn/paper/id?id=1", {
|
|
75
|
-
// // "x-auth-token": token
|
|
76
|
-
// // });
|
|
77
|
-
|
|
78
|
-
// // res = await hp.get("https://www.google.com");
|
|
79
|
-
// console.log('结果:', res);
|
|
80
|
-
// console.log('结果:', hp.cookies);
|
|
81
|
-
// }
|
|
82
|
-
|
|
83
|
-
// 测试
|
|
84
|
-
// async function test() {
|
|
85
|
-
// var hp = new Http();
|
|
86
|
-
// // var res = await hp.get("http://www.baidu.com");
|
|
87
|
-
// // console.log('百度:' + JSON.stringify(res));
|
|
88
|
-
// res = await hp.post("http://127.0.0.1:8000/login", {
|
|
89
|
-
// 'phone': "15817188815",
|
|
90
|
-
// 'password': "asd123"
|
|
91
|
-
// }, null, 'json');
|
|
92
|
-
// console.log('登录:' + JSON.stringify(res));
|
|
93
|
-
// var token = hp.cookies['x-auth-token'];
|
|
94
|
-
// console.log('访问牌:' + token);
|
|
95
|
-
// // res = await hp.get("http://127.0.0.1:8000/paper/id?id=1", {
|
|
96
|
-
// // "x-auth-token": token || ""
|
|
97
|
-
// // });
|
|
98
|
-
// // console.log('结果:' + JSON.stringify(res));
|
|
99
|
-
// // console.log('结果:', hp.cookies);
|
|
100
|
-
// }
|
|
101
|
-
|
|
102
|
-
// async function test() {
|
|
103
|
-
// var hp = new Http();
|
|
104
|
-
// hp.config.headers.Accept = "application/javascript; charset=UTF-8";
|
|
105
|
-
// var url =
|
|
106
|
-
// "http://69.push2.eastmoney.com/api/qt/clist/get?cb=jQuery1124007023275733383882_1586573202818&pn=1&pz=100000&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2&invt=2&fid=f3&fs=m:0+t:6,m:0+t:13,m:0+t:80,m:1+t:2,m:1+t:23&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152";
|
|
107
|
-
// var res = await hp.get(url);
|
|
108
|
-
// console.log(res);
|
|
109
|
-
// }
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
// async function test() {
|
|
113
|
-
// var hp = new Http();
|
|
114
|
-
// hp.config.headers.Accept = "application/javascript; charset=UTF-8";
|
|
115
|
-
// var url ="http://localhost:8001/api/wallet/count";
|
|
116
|
-
// var res = await hp.get(url);
|
|
117
|
-
// console.log(res);
|
|
118
|
-
// }
|
|
119
|
-
|
|
120
|
-
// async function test() {
|
|
121
|
-
// console.log("测试")
|
|
122
|
-
// var hp = new Http();
|
|
123
|
-
// var res = await hp.get('https://www.baidu.com/img/flexible/logo/pc/result.png');
|
|
124
|
-
// console.log(res);
|
|
125
|
-
// fs.writeFile("./logonew.png", res.buffer, "binary", function(err) {
|
|
126
|
-
// if (err) {
|
|
127
|
-
// console.log("下载失败");
|
|
128
|
-
// }
|
|
129
|
-
// console.log("下载成功");
|
|
130
|
-
// });
|
|
131
|
-
// }
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
// async function test () {
|
|
135
|
-
// var hp = new Http();
|
|
136
|
-
// // var url = "http://vip.stock.finance.sina.com.cn/corp/view/vRPD_NewStockIssue.php?page=1&cngem=0&orderBy=NetDate&orderType=desc";
|
|
137
|
-
// var url = "http://www.sccnn.com/gaojingtuku/jierisucai/jianjunjie/20200724-264416.html";
|
|
138
|
-
// var res = await hp.get(url);
|
|
139
|
-
// console.log(res);
|
|
140
|
-
// }
|
|
141
|
-
// test();
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
// async function download(){
|
|
145
|
-
// var hp = new Http({
|
|
146
|
-
// headers: `
|
|
147
|
-
// Referer: https://www.aieliantong.com/admin/index
|
|
148
|
-
// X-Auth-Token: xxx
|
|
149
|
-
// `,
|
|
150
|
-
// cookie: "Hm_lvt_c73f94a74e41202e67d251e6e3f591cb=1697871513; Hm_lpvt_c73f94a74e41202e67d251e6e3f591cb=1698886851; mm:uuid=3QSuThREzVFdRW6/YrT0o0WpriBhXhMdnLmhtJOXwBg="
|
|
151
|
-
// });
|
|
152
|
-
// console.log(hp.headers, hp.cookies);
|
|
153
|
-
// var url = "https://www.copipi.com/p/224/224/becce1fc21d723614b598f5377d5d676.jpg";
|
|
154
|
-
// "./二维码/中文".addDir();
|
|
155
|
-
// var filename = "./二维码/qrcode.jpg".fullname();
|
|
156
|
-
// var file = await hp.download(url, filename);
|
|
157
|
-
// console.log(file);
|
|
158
|
-
// }
|
|
159
|
-
// download();
|
|
160
|
-
|
|
161
|
-
// async function test() {
|
|
162
|
-
// var http = new Http();
|
|
163
|
-
// console.log("开始请求");
|
|
164
|
-
// var options = http.new_options({
|
|
165
|
-
// url: "http://www.hao123.com:8000/test?dd=123"
|
|
166
|
-
// });
|
|
167
|
-
// console.log(1, options);
|
|
168
|
-
|
|
169
|
-
// options = http.new_options({
|
|
170
|
-
// url: "www.hao123.com:8000/test?dd=123"
|
|
171
|
-
// });
|
|
172
|
-
// console.log(2, options);
|
|
173
|
-
|
|
174
|
-
// options = http.new_options({
|
|
175
|
-
// url: "www.hao123.com/test?dd=123"
|
|
176
|
-
// });
|
|
177
|
-
// console.log(3, options);
|
|
178
|
-
|
|
179
|
-
// var options = http.new_options({
|
|
180
|
-
// url: "http://www.hao123.com/test?dd=123"
|
|
181
|
-
// });
|
|
182
|
-
// console.log(4, options);
|
|
183
|
-
|
|
184
|
-
// var options = http.new_options({
|
|
185
|
-
// url: "http://www.hao123.com"
|
|
186
|
-
// });
|
|
187
|
-
// console.log(5, options);
|
|
188
|
-
|
|
189
|
-
// options = http.new_options({
|
|
190
|
-
// url: "https://www.hao123.com:8000"
|
|
191
|
-
// });
|
|
192
|
-
// console.log(6, options);
|
|
46
|
+
/**
|
|
47
|
+
* 高级功能测试
|
|
48
|
+
*/
|
|
49
|
+
async function testAdvancedFeatures() {
|
|
50
|
+
console.log('\n=== 高级功能测试 ===');
|
|
51
|
+
|
|
52
|
+
const http = new Http({
|
|
53
|
+
headers: {
|
|
54
|
+
'User-Agent': 'Test-Agent/1.0'
|
|
55
|
+
},
|
|
56
|
+
cookie: 'initial=test_cookie'
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
// 测试自定义请求头
|
|
61
|
+
console.log('1. 测试自定义请求头...');
|
|
62
|
+
const headersRes = await http.get('https://httpbin.org/headers');
|
|
63
|
+
console.log('自定义请求头测试成功');
|
|
64
|
+
|
|
65
|
+
// 测试URL参数解析
|
|
66
|
+
console.log('2. 测试URL参数解析...');
|
|
67
|
+
const options = http.options();
|
|
68
|
+
console.log('默认选项配置成功:', typeof options);
|
|
69
|
+
|
|
70
|
+
// 测试HTTP选项配置
|
|
71
|
+
console.log('3. 测试HTTP选项配置...');
|
|
72
|
+
const httpOptions = http.httpOptions({
|
|
73
|
+
method: 'GET',
|
|
74
|
+
href: 'https://httpbin.org/get'
|
|
75
|
+
});
|
|
76
|
+
console.log('HTTP选项配置成功');
|
|
77
|
+
|
|
78
|
+
console.log('✅ 高级功能测试通过');
|
|
79
|
+
return true;
|
|
80
|
+
} catch (err) {
|
|
81
|
+
console.error('❌ 高级功能测试失败:', err.message);
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
193
85
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
86
|
+
/**
|
|
87
|
+
* 错误处理测试
|
|
88
|
+
*/
|
|
89
|
+
async function testErrorHandling() {
|
|
90
|
+
console.log('\n=== 错误处理测试 ===');
|
|
91
|
+
|
|
92
|
+
const http = new Http();
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
// 测试不存在的域名
|
|
96
|
+
console.log('1. 测试不存在的域名...');
|
|
97
|
+
try {
|
|
98
|
+
// 设置较短的超时时间,避免长时间等待
|
|
99
|
+
const timeoutHttp = new Http();
|
|
100
|
+
// 使用不存在的域名进行测试
|
|
101
|
+
const res = await timeoutHttp.get('http://nonexistent-domain-12345.test');
|
|
102
|
+
console.log('GET响应状态码:', res.status, '响应消息:', res.message, '响应内容:', res.body);
|
|
103
|
+
console.log('⚠️ 不存在的域名测试 - 请求可能被重定向或超时');
|
|
104
|
+
} catch (err) {
|
|
105
|
+
console.log('不存在的域名处理正确:', err.message);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// 测试网络错误处理
|
|
109
|
+
console.log('2. 测试网络错误处理...');
|
|
110
|
+
try {
|
|
111
|
+
// 尝试访问一个无效的端口
|
|
112
|
+
await http.get('http://localhost:99999');
|
|
113
|
+
console.log('⚠️ 无效端口测试 - 请求可能被系统拒绝');
|
|
114
|
+
} catch (err) {
|
|
115
|
+
console.log('无效端口处理正确:', err.message);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
console.log('✅ 错误处理测试通过');
|
|
119
|
+
return true;
|
|
120
|
+
} catch (err) {
|
|
121
|
+
console.error('❌ 错误处理测试失败:', err.message);
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
199
125
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
126
|
+
/**
|
|
127
|
+
* 主测试函数
|
|
128
|
+
*/
|
|
129
|
+
async function runTests() {
|
|
130
|
+
console.log('开始mm_https模块测试...\n');
|
|
131
|
+
|
|
132
|
+
const results = [];
|
|
133
|
+
|
|
134
|
+
// 运行所有测试
|
|
135
|
+
results.push(await testBasicRequests());
|
|
136
|
+
results.push(await testAdvancedFeatures());
|
|
137
|
+
results.push(await testErrorHandling());
|
|
138
|
+
|
|
139
|
+
// 统计结果
|
|
140
|
+
const passed = results.filter(r => r).length;
|
|
141
|
+
const total = results.length;
|
|
142
|
+
|
|
143
|
+
console.log('\n=== 测试结果汇总 ===');
|
|
144
|
+
console.log(`通过: ${passed}/${total}`);
|
|
145
|
+
|
|
146
|
+
if (passed === total) {
|
|
147
|
+
console.log('🎉 所有测试通过!模块功能正常。');
|
|
148
|
+
process.exit(0);
|
|
149
|
+
} else {
|
|
150
|
+
console.log('⚠️ 部分测试失败,请检查模块功能。');
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
206
154
|
|
|
207
|
-
//
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
155
|
+
// 如果直接运行此文件,则执行测试
|
|
156
|
+
if (require.main === module) {
|
|
157
|
+
runTests().catch(err => {
|
|
158
|
+
console.error('测试执行失败:', err);
|
|
159
|
+
process.exit(1);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
214
162
|
|
|
215
|
-
|
|
163
|
+
module.exports = {
|
|
164
|
+
testBasicRequests,
|
|
165
|
+
testAdvancedFeatures,
|
|
166
|
+
testErrorHandling,
|
|
167
|
+
runTests
|
|
168
|
+
};
|