runner-runtime 1.0.87 → 1.0.89
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/events/api.js +23 -12
- package/index.js +7 -4
- package/package.json +1 -1
- package/tmp/request.js +121 -637
package/events/api.js
CHANGED
|
@@ -1885,10 +1885,12 @@ const initRequestJson = (event, option) => {
|
|
|
1885
1885
|
|
|
1886
1886
|
// 为向上查询获取最终参数做准备,获取正确的 parent_id
|
|
1887
1887
|
if (_.includes(['sample'], event?.type)) {
|
|
1888
|
-
const sampleTargetID = _.get(getAPIFromCollection(option?.collection, _.get(event, `data.
|
|
1888
|
+
const sampleTargetID = _.get(getAPIFromCollection(option?.collection, _.get(event, `data.target_id`)), 'parent_id');
|
|
1889
|
+
// const sampleTargetID = _.get(getAPIFromCollection(option?.collection, _.get(event, `data.parent_id`)), 'target_id');
|
|
1889
1890
|
|
|
1890
1891
|
if (_.isString(sampleTargetID) && sampleTargetID) {
|
|
1891
|
-
getParentTargetIDs(option?.collection,
|
|
1892
|
+
getParentTargetIDs(option?.collection, sampleTargetID, parentIDs);
|
|
1893
|
+
// getParentTargetIDs(option?.collection, requestJson?.sampleTargetID, parentIDs);
|
|
1892
1894
|
}
|
|
1893
1895
|
} else {
|
|
1894
1896
|
getParentTargetIDs(option?.collection, _.get(event, `data.target_id`), parentIDs);
|
|
@@ -1954,6 +1956,7 @@ const initRequestJson = (event, option) => {
|
|
|
1954
1956
|
|
|
1955
1957
|
// 设置 ['auth,pre_script,test,pre_tasks,post_tasks']
|
|
1956
1958
|
let commPara = {}, envServerID = _.get(requestJson, 'server_id');
|
|
1959
|
+
|
|
1957
1960
|
_.forEach(_.reverse(parentIDs), (parent_id) => {
|
|
1958
1961
|
const request = {};
|
|
1959
1962
|
if (parent_id == "0") {
|
|
@@ -2262,6 +2265,14 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
|
|
|
2262
2265
|
_.assign(AllVars, _.get(eventRuntimeData, `variables.${varName}`))
|
|
2263
2266
|
})
|
|
2264
2267
|
preProcessMockExp(request, { postmanJSON }, AllVars, _.pick(option, ['lang', 'custom_functions']))
|
|
2268
|
+
|
|
2269
|
+
if (_.includes(['get_parsed_request'], scene)) {
|
|
2270
|
+
callback(generateHarFromRequest(request));
|
|
2271
|
+
try {
|
|
2272
|
+
run.abort();
|
|
2273
|
+
} catch (e) { }
|
|
2274
|
+
resolve();
|
|
2275
|
+
}
|
|
2265
2276
|
},
|
|
2266
2277
|
|
|
2267
2278
|
beforePrerequest(err, cursor, events, item) {
|
|
@@ -2322,18 +2333,18 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
|
|
|
2322
2333
|
}
|
|
2323
2334
|
},
|
|
2324
2335
|
|
|
2325
|
-
responseStart: (err, cursor, response, request, item, cookies, history) => {
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
},
|
|
2336
|
+
// responseStart: (err, cursor, response, request, item, cookies, history) => {
|
|
2337
|
+
// if (_.includes(['get_parsed_request'], scene)) {
|
|
2338
|
+
// callback(generateHarFromRequest(request));
|
|
2339
|
+
// try {
|
|
2340
|
+
// run.abort();
|
|
2341
|
+
// } catch (e) { }
|
|
2342
|
+
// resolve();
|
|
2343
|
+
// }
|
|
2344
|
+
// },
|
|
2334
2345
|
|
|
2335
2346
|
response: async (err, cursor, response, request, item, cookies, history) => {
|
|
2336
|
-
if (_.includes(['get_parsed_request'], scene)) {
|
|
2347
|
+
if (!_.includes(['get_parsed_request'], scene)) {
|
|
2337
2348
|
callback(generateHarFromRequest(request));
|
|
2338
2349
|
try {
|
|
2339
2350
|
run.abort();
|
package/index.js
CHANGED
|
@@ -14,7 +14,7 @@ const run = async (events, option, callback) => {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const tempEvents = _.cloneDeep(_.flatten(new Array(scene == 'auto_test' ? _.max([_.toInteger(iterationCount), 1]) : 1).fill(events))) || [];
|
|
17
|
-
const
|
|
17
|
+
// const iterationDataArr = _.flatMap(repeatArrayToLength(_.cloneDeep(iterationData), _.max([_.toInteger(iterationCount), 1])), (element) => _.times(_.size(events), () => element));
|
|
18
18
|
const eventOptions = _.pick(option, ["scene", "lang", "project", "env", "globals", "cookies", "system_configs", "custom_functions", "collection", "database_configs", "enable_sandbox", "sleep", "name", "testing_id"]);
|
|
19
19
|
|
|
20
20
|
// 初始化变量
|
|
@@ -29,11 +29,11 @@ const run = async (events, option, callback) => {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const iterationDataArrTemp = [];
|
|
33
33
|
if (scene != 'http_request') {
|
|
34
34
|
// 解析测试数据
|
|
35
35
|
const regex = /{{([^}]+)}}/g;
|
|
36
|
-
_.forEach(
|
|
36
|
+
_.forEach(_.values(_.cloneDeep(iterationData)), (obj, index) => {
|
|
37
37
|
const cloneObj = _.cloneDeep(obj);
|
|
38
38
|
if (_.isObject(obj) && !_.isEmpty(obj)) {
|
|
39
39
|
_.forEach(obj, (val, key) => {
|
|
@@ -56,10 +56,12 @@ const run = async (events, option, callback) => {
|
|
|
56
56
|
})
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
iterationDataArrTemp.push(cloneObj)
|
|
60
60
|
})
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
const iterationDataArr = _.flatMap(repeatArrayToLength(_.cloneDeep(iterationDataArrTemp), _.max([_.toInteger(iterationCount), 1])), (element) => _.times(_.size(events), () => element));
|
|
64
|
+
|
|
63
65
|
const tempVars = { environment: _.get(option, 'env.environment', {}), globals: _.get(option, 'globals', {}), iterationDataArr };
|
|
64
66
|
|
|
65
67
|
['environment', 'globals', 'iterationDataArr'].forEach((type) => {
|
|
@@ -167,6 +169,7 @@ const request2HAR = (events, option) => {
|
|
|
167
169
|
if (_.isObject(event) && _.has(event, 'type')) {
|
|
168
170
|
try {
|
|
169
171
|
await executeEvent(event, _.assign(eventOptions, { scene: 'get_parsed_request' }), (data) => {
|
|
172
|
+
console.log(data,11111)
|
|
170
173
|
resolve(data)
|
|
171
174
|
}, eventRuntimeData, eventResultList);
|
|
172
175
|
} catch (e) {
|
package/package.json
CHANGED
package/tmp/request.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"option": {
|
|
3
|
-
"scene": "
|
|
3
|
+
"scene": "http_request",
|
|
4
|
+
"lang": "zh-cn",
|
|
4
5
|
"globals": {},
|
|
5
6
|
"project": {
|
|
6
7
|
"request": {
|
|
@@ -68,11 +69,16 @@ module.exports = {
|
|
|
68
69
|
"name": "默认服务",
|
|
69
70
|
"sort": 1000,
|
|
70
71
|
"uri": ""
|
|
72
|
+
},
|
|
73
|
+
"4e2fc6f7d0011": {
|
|
74
|
+
"server_id": "4e2fc6f7d0011",
|
|
75
|
+
"name": "无前置URL",
|
|
76
|
+
"sort": 3000,
|
|
77
|
+
"uri": ""
|
|
71
78
|
}
|
|
72
79
|
},
|
|
73
80
|
"environment": {
|
|
74
|
-
"
|
|
75
|
-
"var1": "undefined"
|
|
81
|
+
"aaa": "123"
|
|
76
82
|
}
|
|
77
83
|
},
|
|
78
84
|
"cookies": {
|
|
@@ -97,10 +103,10 @@ module.exports = {
|
|
|
97
103
|
"path": "/",
|
|
98
104
|
"secure": true,
|
|
99
105
|
"httpOnly": true,
|
|
100
|
-
"creation": "2025-06-
|
|
106
|
+
"creation": "2025-06-12T13:22:40.955Z",
|
|
101
107
|
"name": "liveCookie",
|
|
102
108
|
"cookie_id": "2f43d903d001b",
|
|
103
|
-
"expires": "Thu,
|
|
109
|
+
"expires": "Thu, 12 Jun 2025 13:24:41 GMT",
|
|
104
110
|
"project_id": "478597272401000"
|
|
105
111
|
},
|
|
106
112
|
{
|
|
@@ -111,10 +117,10 @@ module.exports = {
|
|
|
111
117
|
"path": "/",
|
|
112
118
|
"secure": true,
|
|
113
119
|
"httpOnly": true,
|
|
114
|
-
"creation": "2025-06-
|
|
120
|
+
"creation": "2025-06-12T13:22:40.956Z",
|
|
115
121
|
"name": "loseCookie",
|
|
116
122
|
"cookie_id": "2f43d903d001c",
|
|
117
|
-
"expires": "Thu,
|
|
123
|
+
"expires": "Thu, 12 Jun 2025 13:22:41 GMT",
|
|
118
124
|
"project_id": "478597272401000"
|
|
119
125
|
}
|
|
120
126
|
]
|
|
@@ -148,727 +154,205 @@ module.exports = {
|
|
|
148
154
|
"client_cert": {}
|
|
149
155
|
},
|
|
150
156
|
"custom_functions": {
|
|
151
|
-
"fn_hello": "\n// This function is generated by Apipost AI.\ntry {\n return new Date().getTime();\n} catch (error) {\n return text;\n}"
|
|
157
|
+
"fn_hello": "\n// This function is generated by Apipost AI.\ntry {\n return new Date().getTime();\n} catch (error) {\n return text;\n}",
|
|
158
|
+
"fn_cardnumber": "\n// This function is generated by Apipost AI.\n// 由于随机生成信用卡卡号需要遵循特定的发卡行规则等复杂逻辑,这里简单模拟返回一个类似信用卡卡号格式的字符串\ntry {\n let cardNumber = '';\n for (let i = 0; i < 16; i++) {\n cardNumber += Math.floor(Math.random() * 10);\n if ((i + 1) % 4 === 0 && i < 15) {\n cardNumber +='';\n }\n }\n return cardNumber;\n} catch (error) {\n return text;\n}",
|
|
159
|
+
"fn_createGH": "\n// This function is generated by Apipost AI.\ntry {\n // 随机生成后8位数字\n let lastEightDigits = '';\n for (let i = 0; i < 8; i++) {\n lastEightDigits += Math.floor(Math.random() * 10);\n }\n return '0371' + lastEightDigits;\n} catch (error) {\n return text;\n}",
|
|
160
|
+
"fn_getgh": "\n// This function is generated by Apipost AI.\ntry {\n // 随机生成后8位数字\n let lastEightDigits = '';\n for (let i = 0; i < 8; i++) {\n lastEightDigits += Math.floor(Math.random() * 10);\n }\n return '0371' + lastEightDigits;\n} catch (error) {\n return text;\n}",
|
|
161
|
+
"fn_getemail": "// This function is generated by Apipost AI.\ntry {\n const randomChars = 'abcdefghijklmnopqrstuvwxyz0123456789';\n let randomStr = '';\n for (let i = 0; i < 8; i++) {\n randomStr += randomChars.charAt(Math.floor(Math.random() * randomChars.length));\n }\n const domains = ['gmail.com', 'yahoo.com', 'hotmail.com', 'outlook.com'];\n const randomDomainIndex = Math.floor(Math.random() * domains.length);\n return randomStr + '@' + domains[randomDomainIndex];\n} catch (error) {\n return text;\n}",
|
|
162
|
+
"fn_getmail": "// This function is generated by Apipost AI.\ntry {\n const randomChars = 'abcdefghijklmnopqrstuvwxyz0123456789';\n let randomStr = '';\n for (let i = 0; i < 8; i++) {\n randomStr += randomChars.charAt(Math.floor(Math.random() * randomChars.length));\n }\n const domains = ['gmail.com', 'yahoo.com', 'hotmail.com', 'outlook.com'];\n const randomDomainIndex = Math.floor(Math.random() * domains.length);\n return randomStr + '@' + domains[randomDomainIndex];\n} catch (error) {\n return text;\n}"
|
|
152
163
|
},
|
|
153
164
|
"collection": [
|
|
154
165
|
{
|
|
155
|
-
"target_id": "
|
|
166
|
+
"target_id": "d3dfd84fd00fe",
|
|
156
167
|
"target_type": "api",
|
|
157
168
|
"parent_id": "0",
|
|
158
|
-
"name": "
|
|
169
|
+
"name": "未命名接口",
|
|
159
170
|
"request": {
|
|
160
171
|
"auth": {
|
|
161
172
|
"type": "inherit"
|
|
162
173
|
},
|
|
163
174
|
"body": {
|
|
175
|
+
"binary": null,
|
|
164
176
|
"mode": "json",
|
|
165
177
|
"parameter": [],
|
|
166
|
-
"raw": "
|
|
178
|
+
"raw": "+499tM7rZuIPk5/xNVjl2TWhg0HSm0CtVt9AncVwOL9kHTLGBRTxNhOWfjTf6xWl",
|
|
167
179
|
"raw_parameter": [],
|
|
168
180
|
"raw_schema": {
|
|
169
181
|
"type": "object"
|
|
170
|
-
},
|
|
171
|
-
"binary": null
|
|
172
|
-
},
|
|
173
|
-
"pre_tasks": [
|
|
174
|
-
{
|
|
175
|
-
"type": "customScript",
|
|
176
|
-
"enabled": 1,
|
|
177
|
-
"data": "",
|
|
178
|
-
"name": "自定义脚本",
|
|
179
|
-
"id": "3a1e79dbbff009"
|
|
180
182
|
}
|
|
181
|
-
],
|
|
182
|
-
"post_tasks": [
|
|
183
|
-
{
|
|
184
|
-
"type": "customScript",
|
|
185
|
-
"enabled": 1,
|
|
186
|
-
"data": "",
|
|
187
|
-
"name": "自定义脚本",
|
|
188
|
-
"id": "3a30e2247ff013"
|
|
189
|
-
}
|
|
190
|
-
],
|
|
191
|
-
"header": {
|
|
192
|
-
"parameter": []
|
|
193
|
-
},
|
|
194
|
-
"query": {
|
|
195
|
-
"query_add_equal": 1,
|
|
196
|
-
"parameter": []
|
|
197
183
|
},
|
|
198
184
|
"cookie": {
|
|
199
|
-
"cookie_encode": 1,
|
|
200
185
|
"parameter": []
|
|
201
186
|
},
|
|
202
|
-
"
|
|
203
|
-
"parameter": []
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
"parents": [],
|
|
207
|
-
"method": "POST",
|
|
208
|
-
"protocol": "http/1.1",
|
|
209
|
-
"url": "/api/register",
|
|
210
|
-
"pre_url": ""
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
"target_id": "3866f5e8f2a152",
|
|
214
|
-
"target_type": "api",
|
|
215
|
-
"parent_id": "0",
|
|
216
|
-
"name": "手机实名校验",
|
|
217
|
-
"request": {
|
|
218
|
-
"auth": {
|
|
219
|
-
"type": "inherit"
|
|
220
|
-
},
|
|
221
|
-
"body": {
|
|
222
|
-
"mode": "json",
|
|
187
|
+
"header": {
|
|
223
188
|
"parameter": [
|
|
224
189
|
{
|
|
225
|
-
"param_id": "3867147772a16f",
|
|
226
|
-
"description": "在个人中心->我的数据,接口名称上方查看",
|
|
227
|
-
"field_type": "string",
|
|
228
190
|
"is_checked": 1,
|
|
229
|
-
"key": "
|
|
191
|
+
"key": "Accept",
|
|
192
|
+
"value": "*/*",
|
|
230
193
|
"not_null": 1,
|
|
231
|
-
"
|
|
232
|
-
"
|
|
233
|
-
"
|
|
234
|
-
"file_base64": "",
|
|
235
|
-
"schema": {
|
|
236
|
-
"type": "string"
|
|
237
|
-
}
|
|
194
|
+
"description": "",
|
|
195
|
+
"field_type": "String",
|
|
196
|
+
"param_id": "d3dfd847d00f0"
|
|
238
197
|
},
|
|
239
198
|
{
|
|
240
|
-
"param_id": "386715acf2a171",
|
|
241
|
-
"description": "姓名",
|
|
242
|
-
"field_type": "string",
|
|
243
199
|
"is_checked": 1,
|
|
244
|
-
"key": "
|
|
200
|
+
"key": "Accept-Encoding",
|
|
201
|
+
"value": "gzip, deflate, br",
|
|
245
202
|
"not_null": 1,
|
|
246
|
-
"
|
|
247
|
-
"
|
|
248
|
-
"
|
|
249
|
-
"file_base64": "",
|
|
250
|
-
"schema": {
|
|
251
|
-
"type": "string"
|
|
252
|
-
}
|
|
203
|
+
"description": "",
|
|
204
|
+
"field_type": "String",
|
|
205
|
+
"param_id": "d3dfd847d00f1"
|
|
253
206
|
},
|
|
254
207
|
{
|
|
255
|
-
"param_id": "386716dbb2a174",
|
|
256
|
-
"description": "身份证号码",
|
|
257
|
-
"field_type": "string",
|
|
258
208
|
"is_checked": 1,
|
|
259
|
-
"key": "
|
|
209
|
+
"key": "Bwtoken",
|
|
210
|
+
"value": "aca61450ee6c9c1d18554051d4e0204d",
|
|
260
211
|
"not_null": 1,
|
|
261
|
-
"
|
|
262
|
-
"
|
|
263
|
-
"
|
|
264
|
-
"file_base64": "",
|
|
265
|
-
"schema": {
|
|
266
|
-
"type": "string"
|
|
267
|
-
}
|
|
212
|
+
"description": "",
|
|
213
|
+
"field_type": "String",
|
|
214
|
+
"param_id": "d3dfd847d00f2"
|
|
268
215
|
},
|
|
269
216
|
{
|
|
270
|
-
"param_id": "38671813b2a176",
|
|
271
|
-
"description": "手机号码",
|
|
272
|
-
"field_type": "string",
|
|
273
217
|
"is_checked": 1,
|
|
274
|
-
"key": "
|
|
218
|
+
"key": "Cache-Control",
|
|
219
|
+
"value": "no-cache",
|
|
275
220
|
"not_null": 1,
|
|
276
|
-
"
|
|
277
|
-
"
|
|
278
|
-
"
|
|
279
|
-
"file_base64": "",
|
|
280
|
-
"schema": {
|
|
281
|
-
"type": "string",
|
|
282
|
-
"default": ""
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
"param_id": "386719b1f2a178",
|
|
287
|
-
"description": "是否显示手机运营商,1:显示,0:不显示(默认)",
|
|
288
|
-
"field_type": "integer",
|
|
289
|
-
"is_checked": 1,
|
|
290
|
-
"key": "type",
|
|
291
|
-
"not_null": -1,
|
|
292
|
-
"value": "",
|
|
293
|
-
"content_type": "",
|
|
294
|
-
"file_name": "",
|
|
295
|
-
"file_base64": "",
|
|
296
|
-
"schema": {
|
|
297
|
-
"type": "integer"
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
"param_id": "38671b23b2a17a",
|
|
302
|
-
"description": "是否显示聚合订单号,1:显示,0:不显示(默认)",
|
|
303
|
-
"field_type": "integer",
|
|
304
|
-
"is_checked": 1,
|
|
305
|
-
"key": "showid",
|
|
306
|
-
"not_null": -1,
|
|
307
|
-
"value": "",
|
|
308
|
-
"content_type": "",
|
|
309
|
-
"file_name": "",
|
|
310
|
-
"file_base64": "",
|
|
311
|
-
"schema": {
|
|
312
|
-
"type": "integer"
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
"param_id": "38671cc572a17c",
|
|
317
|
-
"description": "是否显示手机号归属地,1:显示,0:不显示(默认)",
|
|
318
|
-
"field_type": "integer",
|
|
319
|
-
"is_checked": 1,
|
|
320
|
-
"key": "province",
|
|
321
|
-
"not_null": -1,
|
|
322
|
-
"value": "",
|
|
323
|
-
"content_type": "",
|
|
324
|
-
"file_name": "",
|
|
325
|
-
"file_base64": "",
|
|
326
|
-
"schema": {
|
|
327
|
-
"type": "integer"
|
|
328
|
-
}
|
|
221
|
+
"description": "",
|
|
222
|
+
"field_type": "String",
|
|
223
|
+
"param_id": "d3dfd847d00f3"
|
|
329
224
|
},
|
|
330
225
|
{
|
|
331
|
-
"param_id": "38671e0572a17e",
|
|
332
|
-
"description": "是否显示匹配详情码,1:显示,0:不显示(默认)",
|
|
333
|
-
"field_type": "integer",
|
|
334
226
|
"is_checked": 1,
|
|
335
|
-
"key": "
|
|
336
|
-
"
|
|
337
|
-
"
|
|
338
|
-
"
|
|
339
|
-
"
|
|
340
|
-
"
|
|
341
|
-
"schema": {
|
|
342
|
-
"type": "integer"
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
],
|
|
346
|
-
"raw": "{\n \"lastLoginAt\":1\n}",
|
|
347
|
-
"raw_parameter": [],
|
|
348
|
-
"raw_schema": {
|
|
349
|
-
"type": "object",
|
|
350
|
-
"required": [
|
|
351
|
-
"id"
|
|
352
|
-
],
|
|
353
|
-
"properties": {
|
|
354
|
-
"id": {
|
|
355
|
-
"type": "integer",
|
|
356
|
-
"example": 1
|
|
357
|
-
}
|
|
227
|
+
"key": "Connection",
|
|
228
|
+
"value": "keep-alive",
|
|
229
|
+
"not_null": 1,
|
|
230
|
+
"description": "",
|
|
231
|
+
"field_type": "String",
|
|
232
|
+
"param_id": "d3dfd847d00f4"
|
|
358
233
|
},
|
|
359
|
-
"x-schema-orders": [
|
|
360
|
-
"id"
|
|
361
|
-
]
|
|
362
|
-
},
|
|
363
|
-
"binary": null
|
|
364
|
-
},
|
|
365
|
-
"pre_tasks": [
|
|
366
|
-
{
|
|
367
|
-
"type": "customScript",
|
|
368
|
-
"enabled": 1,
|
|
369
|
-
"data": "// This code is generated by [Apipost] AI.\nfunction encryptRequestParamsWithAES() {\n try {\n // 获取请求参数\n let requestParams = request.request_bodys;\n if (_.isString(requestParams)) {\n try {\n requestParams = JSON5.parse(requestParams);\n } catch (e) {\n console.warn('请求参数解析为JSON失败');\n return;\n }\n }\n // 将请求参数转换为字符串\n const paramsStr = JSON5.stringify(requestParams);\n // 使用CryptoJS进行AES加密,这里假设密钥为固定值,实际应用中应妥善处理密钥\n const encrypted = CryptoJS.AES.encrypt(paramsStr, 'Secret Passphrase');\n // 设置加密后的参数为请求体\n pm.setRequestBody(encrypted.toString());\n } catch (error) {\n console.error('加密请求参数时出错:', error);\n }\n}",
|
|
370
|
-
"name": "自定义脚本",
|
|
371
|
-
"id": "3a0094827ff006"
|
|
372
|
-
}
|
|
373
|
-
],
|
|
374
|
-
"post_tasks": [
|
|
375
|
-
{
|
|
376
|
-
"type": "customScript",
|
|
377
|
-
"enabled": 1,
|
|
378
|
-
"data": "// This code is generated by [Apipost] AI.\nfunction generateVisualizerScript() {\n try {\n const objData = pm.response.json();\n const template = `\n <style>\n .table { background-color: #FFFFFF; border-radius: 8px; }\n .table th { background-color: #F0F0F0; padding: 10px; border-bottom: 1px solid #DDDDDD; }\n .table td { padding: 10px; border-bottom: 1px solid #DDDDDD; }\n </style>\n <table class=\"table\">\n <thead>\n <tr>\n <th>字段</th>\n <th>值</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>resultcode</td>\n <td>{{resultcode}}</td>\n </tr>\n <tr>\n <td>reason</td>\n <td>{{reason}}</td>\n </tr>\n <tr>\n <td>result</td>\n <td>{{result}}</td>\n </tr>\n <tr>\n <td>error_code</td>\n <td>{{error_code}}</td>\n </tr>\n </tbody>\n </table>\n `;\n pm.visualizer.set(template, objData);\n } catch (e) {\n console.error('生成可视化脚本时出错:', e);\n }\n}\ngenerateVisualizerScript();",
|
|
379
|
-
"name": "自定义脚本",
|
|
380
|
-
"id": "39e9dc0dfff010"
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
"type": "customScript",
|
|
384
|
-
"enabled": 1,
|
|
385
|
-
"data": "// 断言响应状态码是否为200\npm.test(\"响应状态码为200\", function () {\n pm.response.to.have.status(200);\n});\n// 断言响应时间是否小于300毫秒(行业推荐平均响应时间)\npm.test(\"响应时间小于300毫秒\", function () {\n pm.expect(pm.response.responseTime).to.be.below(300);\n});\n// 断言响应体中resultcode字段是否为101\npm.test(\"响应体中resultcode字段为101\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.resultcode).to.eql(\"101\");\n});\n// 断言响应体中reason字段是否为错误的请求KEY\npm.test(\"响应体中reason字段为错误的请求KEY\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.reason).to.eql(\"错误的请求KEY\");\n});\n// 断言响应体中error_code字段是否为10001\npm.test(\"响应体中error_code字段为10001\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.error_code).to.eql(10001);\n});\n// 断言响应体是否为有效的JSON格式\npm.test(\"响应体必须是json\", function () {\n pm.response.to.be.json;\n});",
|
|
386
|
-
"name": "AI断言",
|
|
387
|
-
"id": "3a01bc577ff018"
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
"type": "customScript",
|
|
391
|
-
"enabled": 1,
|
|
392
|
-
"data": "// 断言响应状态码是否为200\npm.test(\"响应状态码为200\", function () {\n pm.response.to.have.status(200);\n});\n// 断言响应时间是否小于300毫秒(行业推荐平均响应时间)\npm.test(\"响应时间小于300毫秒\", function () {\n pm.expect(pm.response.responseTime).to.be.below(300);\n});\n// 断言响应体中的resultcode是否为101\npm.test(\"响应体中的resultcode为101\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.resultcode).to.eql(\"101\");\n});\n// 断言响应体中的reason是否为错误的请求KEY\npm.test(\"响应体中的reason为错误的请求KEY\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.reason).to.eql(\"错误的请求KEY\");\n});\n// 断言响应体中的error_code是否为10001\npm.test(\"响应体中的error_code为10001\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.error_code).to.eql(10001);\n});",
|
|
393
|
-
"name": "AI Assertion",
|
|
394
|
-
"id": "3a025d25fff008"
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
"type": "customScript",
|
|
398
|
-
"enabled": 1,
|
|
399
|
-
"data": "// 断言响应状态码是否为200,通常200表示请求成功\npm.test(\"响应状态码为200\", function () {\n pm.response.to.have.status(200);\n});\n// 断言响应时间是否小于300毫秒,300毫秒是行业推荐的平均响应时间\npm.test(\"响应时间小于300毫秒\", function () {\n pm.expect(pm.response.responseTime).to.be.below(300);\n});\n// 断言响应体中的resultcode字段是否为101\npm.test(\"响应体中的resultcode为101\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.resultcode).to.eql(\"101\");\n});\n// 断言响应体中的reason字段是否为'错误的请求KEY'\npm.test(\"响应体中的reason为错误的请求KEY\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.reason).to.eql(\"错误的请求KEY\");\n});\n// 断言响应体中的error_code字段是否为10001\npm.test(\"响应体中的error_code为10001\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.error_code).to.eql(10001);\n});",
|
|
400
|
-
"name": "AI断言",
|
|
401
|
-
"id": "3a1eabf07ff00c"
|
|
402
|
-
}
|
|
403
|
-
],
|
|
404
|
-
"header": {
|
|
405
|
-
"parameter": [
|
|
406
234
|
{
|
|
407
|
-
"param_id": "38670379f2a15a",
|
|
408
|
-
"description": "请求内容类型",
|
|
409
|
-
"field_type": "string",
|
|
410
235
|
"is_checked": 1,
|
|
411
236
|
"key": "Content-Type",
|
|
237
|
+
"value": "application/json",
|
|
412
238
|
"not_null": 1,
|
|
413
|
-
"
|
|
414
|
-
"
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}
|
|
418
|
-
]
|
|
419
|
-
},
|
|
420
|
-
"query": {
|
|
421
|
-
"query_add_equal": 1,
|
|
422
|
-
"parameter": [
|
|
239
|
+
"description": "",
|
|
240
|
+
"field_type": "String",
|
|
241
|
+
"param_id": "d3dfd847d00f5"
|
|
242
|
+
},
|
|
423
243
|
{
|
|
424
|
-
"param_id": "3867057a72a15c",
|
|
425
|
-
"description": "在个人中心->我的数据,接口名称上方查看",
|
|
426
|
-
"field_type": "string",
|
|
427
244
|
"is_checked": 1,
|
|
428
|
-
"key": "
|
|
245
|
+
"key": "Host",
|
|
246
|
+
"value": "lqpt.chinatax.gov.cn:8443",
|
|
429
247
|
"not_null": 1,
|
|
430
|
-
"
|
|
431
|
-
"
|
|
432
|
-
|
|
433
|
-
}
|
|
248
|
+
"description": "",
|
|
249
|
+
"field_type": "String",
|
|
250
|
+
"param_id": "d3dfd847d00f6"
|
|
434
251
|
},
|
|
435
252
|
{
|
|
436
|
-
"param_id": "386706cf72a15e",
|
|
437
|
-
"description": "姓名",
|
|
438
|
-
"field_type": "string",
|
|
439
253
|
"is_checked": 1,
|
|
440
|
-
"key": "
|
|
254
|
+
"key": "User-Agent",
|
|
255
|
+
"value": "PostmanRuntime-ApipostRuntime/1.1.0",
|
|
441
256
|
"not_null": 1,
|
|
442
|
-
"
|
|
443
|
-
"
|
|
444
|
-
|
|
445
|
-
}
|
|
257
|
+
"description": "",
|
|
258
|
+
"field_type": "String",
|
|
259
|
+
"param_id": "d3dfd847d00f7"
|
|
446
260
|
},
|
|
447
261
|
{
|
|
448
|
-
"param_id": "38670830b2a160",
|
|
449
|
-
"description": "身份证号码",
|
|
450
|
-
"field_type": "string",
|
|
451
262
|
"is_checked": 1,
|
|
452
|
-
"key": "
|
|
453
|
-
"not_null": 1,
|
|
263
|
+
"key": "access_signature",
|
|
454
264
|
"value": "",
|
|
455
|
-
"
|
|
456
|
-
|
|
457
|
-
|
|
265
|
+
"not_null": 1,
|
|
266
|
+
"description": "",
|
|
267
|
+
"field_type": "String",
|
|
268
|
+
"param_id": "d3dfd847d00f8"
|
|
458
269
|
},
|
|
459
270
|
{
|
|
460
|
-
"param_id": "38670975f2a162",
|
|
461
|
-
"description": "手机号码",
|
|
462
|
-
"field_type": "string",
|
|
463
271
|
"is_checked": 1,
|
|
464
|
-
"key": "
|
|
272
|
+
"key": "fwbm",
|
|
273
|
+
"value": "CXNCPSGQYFXLX",
|
|
465
274
|
"not_null": 1,
|
|
466
|
-
"
|
|
467
|
-
"
|
|
468
|
-
|
|
469
|
-
}
|
|
275
|
+
"description": "",
|
|
276
|
+
"field_type": "String",
|
|
277
|
+
"param_id": "d3dfd847d00f9"
|
|
470
278
|
},
|
|
471
279
|
{
|
|
472
|
-
"param_id": "38670b59f2a164",
|
|
473
|
-
"description": "是否显示手机运营商,1:显示,0:不显示(默认)",
|
|
474
|
-
"field_type": "integer",
|
|
475
280
|
"is_checked": 1,
|
|
476
|
-
"key": "
|
|
477
|
-
"
|
|
478
|
-
"
|
|
479
|
-
"
|
|
480
|
-
|
|
481
|
-
|
|
281
|
+
"key": "jrdwptbh",
|
|
282
|
+
"value": "174ba8fa83cf8cd6d905",
|
|
283
|
+
"not_null": 1,
|
|
284
|
+
"description": "",
|
|
285
|
+
"field_type": "String",
|
|
286
|
+
"param_id": "d3dfd847d00fa"
|
|
482
287
|
},
|
|
483
288
|
{
|
|
484
|
-
"param_id": "38670cfa32a166",
|
|
485
|
-
"description": "是否显示聚合订单号,1:显示,0:不显示(默认)",
|
|
486
|
-
"field_type": "integer",
|
|
487
289
|
"is_checked": 1,
|
|
488
|
-
"key": "
|
|
489
|
-
"
|
|
490
|
-
"
|
|
491
|
-
"
|
|
492
|
-
|
|
493
|
-
|
|
290
|
+
"key": "nlbm",
|
|
291
|
+
"value": "202019",
|
|
292
|
+
"not_null": 1,
|
|
293
|
+
"description": "",
|
|
294
|
+
"field_type": "String",
|
|
295
|
+
"param_id": "d3dfd847d00fb"
|
|
494
296
|
},
|
|
495
297
|
{
|
|
496
|
-
"param_id": "38670ecd72a168",
|
|
497
|
-
"description": "是否显示手机号归属地,1:显示,0:不显示(默认)",
|
|
498
|
-
"field_type": "integer",
|
|
499
298
|
"is_checked": 1,
|
|
500
|
-
"key": "
|
|
501
|
-
"
|
|
502
|
-
"
|
|
503
|
-
"
|
|
504
|
-
|
|
505
|
-
|
|
299
|
+
"key": "sydwptbh",
|
|
300
|
+
"value": "174ba8fa83cf8cd6d905",
|
|
301
|
+
"not_null": 1,
|
|
302
|
+
"description": "",
|
|
303
|
+
"field_type": "String",
|
|
304
|
+
"param_id": "d3dfd847d00fc"
|
|
506
305
|
},
|
|
507
306
|
{
|
|
508
|
-
"param_id": "38671070b2a16a",
|
|
509
|
-
"description": "是否显示匹配详情码,1:显示,0:不显示(默认)",
|
|
510
|
-
"field_type": "integer",
|
|
511
307
|
"is_checked": 1,
|
|
512
|
-
"key": "
|
|
513
|
-
"
|
|
514
|
-
"
|
|
515
|
-
"
|
|
516
|
-
|
|
517
|
-
|
|
308
|
+
"key": "ylbm",
|
|
309
|
+
"value": "202019",
|
|
310
|
+
"not_null": 1,
|
|
311
|
+
"description": "",
|
|
312
|
+
"field_type": "String",
|
|
313
|
+
"param_id": "d3dfd847d00fd"
|
|
518
314
|
}
|
|
519
315
|
]
|
|
520
316
|
},
|
|
521
|
-
"
|
|
522
|
-
|
|
523
|
-
|
|
317
|
+
"post_tasks": [],
|
|
318
|
+
"pre_tasks": [],
|
|
319
|
+
"query": {
|
|
320
|
+
"parameter": [
|
|
321
|
+
{
|
|
322
|
+
"is_checked": 1,
|
|
323
|
+
"key": "id",
|
|
324
|
+
"value": "{{$mockjs.idcard()}}",
|
|
325
|
+
"not_null": 1,
|
|
326
|
+
"description": "",
|
|
327
|
+
"field_type": "String",
|
|
328
|
+
"param_id": "d3dfd847d00fd"
|
|
329
|
+
}
|
|
330
|
+
],
|
|
331
|
+
"query_add_equal": 1
|
|
524
332
|
},
|
|
525
333
|
"restful": {
|
|
526
334
|
"parameter": []
|
|
527
335
|
}
|
|
528
336
|
},
|
|
529
337
|
"parents": [],
|
|
530
|
-
"
|
|
338
|
+
"server_id": "0",
|
|
339
|
+
"method": "POST",
|
|
531
340
|
"protocol": "http/1.1",
|
|
532
|
-
"url": "https://
|
|
341
|
+
// "url": "https://",
|
|
342
|
+
"url": "lqpt.chinatax.gov.cn:8443/access/newsandbox/v2/invoke/202019/CXNCPSGQYFXLX?id={{$timestamp}}",
|
|
533
343
|
"pre_url": ""
|
|
534
344
|
}
|
|
535
345
|
],
|
|
536
|
-
"database_configs": {}
|
|
537
|
-
"name": "未命名测试用例",
|
|
538
|
-
"ignore_error": -1,
|
|
539
|
-
"enable_sandbox": -1,
|
|
540
|
-
"iterationCount": 2,
|
|
541
|
-
"sleep": 0,
|
|
542
|
-
"testing_id": "2f372b7bd0007",
|
|
543
|
-
"iterates_data_id": "41d7d5dfd0007",
|
|
544
|
-
"iterationData": [
|
|
545
|
-
{
|
|
546
|
-
"v1": "",
|
|
547
|
-
"a": "{{$function.fn_hello()}}",
|
|
548
|
-
"b": "{{$mockjs.idcard()}}",
|
|
549
|
-
"c": "lucy"
|
|
550
|
-
}
|
|
551
|
-
]
|
|
346
|
+
"database_configs": {}
|
|
552
347
|
},
|
|
553
348
|
"test_events": [
|
|
554
349
|
{
|
|
555
350
|
"type": "api",
|
|
556
|
-
"auto_sync": false,
|
|
557
|
-
"test_id": "2f372b7bd0007",
|
|
558
|
-
"event_id": "41dd2b8bd0020",
|
|
559
|
-
"enabled": 1,
|
|
560
351
|
"data": {
|
|
561
|
-
"target_id": "
|
|
352
|
+
"target_id": "d3dfd84fd00fe",
|
|
562
353
|
"project_id": "478597272401000",
|
|
563
354
|
"parent_id": "0",
|
|
564
|
-
"target_type": "api"
|
|
565
|
-
"apiData": {
|
|
566
|
-
"name": "注册接口",
|
|
567
|
-
"method": "POST",
|
|
568
|
-
"protocol": "http/1.1",
|
|
569
|
-
"url": "https://go.apipost.cn/?a={{a}}",
|
|
570
|
-
"request": {
|
|
571
|
-
"auth": {
|
|
572
|
-
"type": "inherit"
|
|
573
|
-
},
|
|
574
|
-
"body": {
|
|
575
|
-
"mode": "json",
|
|
576
|
-
"parameter": [],
|
|
577
|
-
"raw": "{\n \"username\": \"\",\n \"password\": \"\",\n \"lastLoginAt\":\"\"\n}",
|
|
578
|
-
"raw_parameter": [],
|
|
579
|
-
"raw_schema": {
|
|
580
|
-
"type": "object"
|
|
581
|
-
},
|
|
582
|
-
"binary": null
|
|
583
|
-
},
|
|
584
|
-
"pre_tasks": [
|
|
585
|
-
{
|
|
586
|
-
"type": "customScript",
|
|
587
|
-
"enabled": 1,
|
|
588
|
-
"data": "",
|
|
589
|
-
"name": "自定义脚本",
|
|
590
|
-
"id": "3a1e79dbbff009"
|
|
591
|
-
}
|
|
592
|
-
],
|
|
593
|
-
"post_tasks": [
|
|
594
|
-
{
|
|
595
|
-
"type": "customScript",
|
|
596
|
-
"enabled": 1,
|
|
597
|
-
"data": "",
|
|
598
|
-
"name": "自定义脚本",
|
|
599
|
-
"id": "3a30e2247ff013"
|
|
600
|
-
}
|
|
601
|
-
],
|
|
602
|
-
"header": {
|
|
603
|
-
"parameter": []
|
|
604
|
-
},
|
|
605
|
-
"query": {
|
|
606
|
-
"query_add_equal": 1,
|
|
607
|
-
"parameter": [
|
|
608
|
-
{
|
|
609
|
-
"param_id": "41de01afd004b",
|
|
610
|
-
"field_type": "String",
|
|
611
|
-
"is_checked": 1,
|
|
612
|
-
"key": "a",
|
|
613
|
-
"not_null": 1,
|
|
614
|
-
"value": "{{a}}",
|
|
615
|
-
"description": ""
|
|
616
|
-
}
|
|
617
|
-
]
|
|
618
|
-
},
|
|
619
|
-
"cookie": {
|
|
620
|
-
"cookie_encode": 1,
|
|
621
|
-
"parameter": []
|
|
622
|
-
},
|
|
623
|
-
"restful": {
|
|
624
|
-
"parameter": []
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
},
|
|
630
|
-
{
|
|
631
|
-
"type": "api",
|
|
632
|
-
"auto_sync": false,
|
|
633
|
-
"test_id": "2f372b7bd0007",
|
|
634
|
-
"event_id": "41e136d7d006b",
|
|
635
|
-
"enabled": 1,
|
|
636
|
-
"data": {
|
|
637
|
-
"target_id": "3866f5e8f2a152",
|
|
638
|
-
"project_id": "478597272401000",
|
|
639
|
-
"parent_id": "0",
|
|
640
|
-
"target_type": "api",
|
|
641
|
-
"apiData": {
|
|
642
|
-
"name": "手机实名校验",
|
|
643
|
-
"method": "GET",
|
|
644
|
-
"protocol": "http/1.1",
|
|
645
|
-
"url": "https://v.juhe.cn/telecom/query?a={{a}}",
|
|
646
|
-
"request": {
|
|
647
|
-
"auth": {
|
|
648
|
-
"type": "inherit"
|
|
649
|
-
},
|
|
650
|
-
"body": {
|
|
651
|
-
"mode": "json",
|
|
652
|
-
"parameter": [
|
|
653
|
-
{
|
|
654
|
-
"param_id": "3867147772a16f",
|
|
655
|
-
"description": "在个人中心->我的数据,接口名称上方查看",
|
|
656
|
-
"field_type": "string",
|
|
657
|
-
"is_checked": 1,
|
|
658
|
-
"key": "key",
|
|
659
|
-
"not_null": 1,
|
|
660
|
-
"value": "",
|
|
661
|
-
"content_type": "",
|
|
662
|
-
"file_name": "",
|
|
663
|
-
"file_base64": "",
|
|
664
|
-
"schema": {
|
|
665
|
-
"type": "string"
|
|
666
|
-
}
|
|
667
|
-
},
|
|
668
|
-
{
|
|
669
|
-
"param_id": "386715acf2a171",
|
|
670
|
-
"description": "姓名",
|
|
671
|
-
"field_type": "string",
|
|
672
|
-
"is_checked": 1,
|
|
673
|
-
"key": "realname",
|
|
674
|
-
"not_null": 1,
|
|
675
|
-
"value": "",
|
|
676
|
-
"content_type": "",
|
|
677
|
-
"file_name": "",
|
|
678
|
-
"file_base64": "",
|
|
679
|
-
"schema": {
|
|
680
|
-
"type": "string"
|
|
681
|
-
}
|
|
682
|
-
},
|
|
683
|
-
{
|
|
684
|
-
"param_id": "386716dbb2a174",
|
|
685
|
-
"description": "身份证号码",
|
|
686
|
-
"field_type": "string",
|
|
687
|
-
"is_checked": 1,
|
|
688
|
-
"key": "idcard",
|
|
689
|
-
"not_null": 1,
|
|
690
|
-
"value": "",
|
|
691
|
-
"content_type": "",
|
|
692
|
-
"file_name": "",
|
|
693
|
-
"file_base64": "",
|
|
694
|
-
"schema": {
|
|
695
|
-
"type": "string"
|
|
696
|
-
}
|
|
697
|
-
},
|
|
698
|
-
{
|
|
699
|
-
"param_id": "38671813b2a176",
|
|
700
|
-
"description": "手机号码",
|
|
701
|
-
"field_type": "string",
|
|
702
|
-
"is_checked": 1,
|
|
703
|
-
"key": "mobile",
|
|
704
|
-
"not_null": 1,
|
|
705
|
-
"value": "",
|
|
706
|
-
"content_type": "",
|
|
707
|
-
"file_name": "",
|
|
708
|
-
"file_base64": "",
|
|
709
|
-
"schema": {
|
|
710
|
-
"type": "string",
|
|
711
|
-
"default": ""
|
|
712
|
-
}
|
|
713
|
-
},
|
|
714
|
-
{
|
|
715
|
-
"param_id": "386719b1f2a178",
|
|
716
|
-
"description": "是否显示手机运营商,1:显示,0:不显示(默认)",
|
|
717
|
-
"field_type": "integer",
|
|
718
|
-
"is_checked": 1,
|
|
719
|
-
"key": "type",
|
|
720
|
-
"not_null": -1,
|
|
721
|
-
"value": "",
|
|
722
|
-
"content_type": "",
|
|
723
|
-
"file_name": "",
|
|
724
|
-
"file_base64": "",
|
|
725
|
-
"schema": {
|
|
726
|
-
"type": "integer"
|
|
727
|
-
}
|
|
728
|
-
},
|
|
729
|
-
{
|
|
730
|
-
"param_id": "38671b23b2a17a",
|
|
731
|
-
"description": "是否显示聚合订单号,1:显示,0:不显示(默认)",
|
|
732
|
-
"field_type": "integer",
|
|
733
|
-
"is_checked": 1,
|
|
734
|
-
"key": "showid",
|
|
735
|
-
"not_null": -1,
|
|
736
|
-
"value": "",
|
|
737
|
-
"content_type": "",
|
|
738
|
-
"file_name": "",
|
|
739
|
-
"file_base64": "",
|
|
740
|
-
"schema": {
|
|
741
|
-
"type": "integer"
|
|
742
|
-
}
|
|
743
|
-
},
|
|
744
|
-
{
|
|
745
|
-
"param_id": "38671cc572a17c",
|
|
746
|
-
"description": "是否显示手机号归属地,1:显示,0:不显示(默认)",
|
|
747
|
-
"field_type": "integer",
|
|
748
|
-
"is_checked": 1,
|
|
749
|
-
"key": "province",
|
|
750
|
-
"not_null": -1,
|
|
751
|
-
"value": "",
|
|
752
|
-
"content_type": "",
|
|
753
|
-
"file_name": "",
|
|
754
|
-
"file_base64": "",
|
|
755
|
-
"schema": {
|
|
756
|
-
"type": "integer"
|
|
757
|
-
}
|
|
758
|
-
},
|
|
759
|
-
{
|
|
760
|
-
"param_id": "38671e0572a17e",
|
|
761
|
-
"description": "是否显示匹配详情码,1:显示,0:不显示(默认)",
|
|
762
|
-
"field_type": "integer",
|
|
763
|
-
"is_checked": 1,
|
|
764
|
-
"key": "detail",
|
|
765
|
-
"not_null": -1,
|
|
766
|
-
"value": "",
|
|
767
|
-
"content_type": "",
|
|
768
|
-
"file_name": "",
|
|
769
|
-
"file_base64": "",
|
|
770
|
-
"schema": {
|
|
771
|
-
"type": "integer"
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
],
|
|
775
|
-
"raw": "{\n \"lastLoginAt\":1\n}",
|
|
776
|
-
"raw_parameter": [],
|
|
777
|
-
"raw_schema": {
|
|
778
|
-
"type": "object",
|
|
779
|
-
"required": [
|
|
780
|
-
"id"
|
|
781
|
-
],
|
|
782
|
-
"properties": {
|
|
783
|
-
"id": {
|
|
784
|
-
"type": "integer",
|
|
785
|
-
"example": 1
|
|
786
|
-
}
|
|
787
|
-
},
|
|
788
|
-
"x-schema-orders": [
|
|
789
|
-
"id"
|
|
790
|
-
]
|
|
791
|
-
},
|
|
792
|
-
"binary": null
|
|
793
|
-
},
|
|
794
|
-
"pre_tasks": [
|
|
795
|
-
{
|
|
796
|
-
"type": "customScript",
|
|
797
|
-
"enabled": 1,
|
|
798
|
-
"data": "// This code is generated by [Apipost] AI.\nfunction encryptRequestParamsWithAES() {\n try {\n // 获取请求参数\n let requestParams = request.request_bodys;\n if (_.isString(requestParams)) {\n try {\n requestParams = JSON5.parse(requestParams);\n } catch (e) {\n console.warn('请求参数解析为JSON失败');\n return;\n }\n }\n // 将请求参数转换为字符串\n const paramsStr = JSON5.stringify(requestParams);\n // 使用CryptoJS进行AES加密,这里假设密钥为固定值,实际应用中应妥善处理密钥\n const encrypted = CryptoJS.AES.encrypt(paramsStr, 'Secret Passphrase');\n // 设置加密后的参数为请求体\n pm.setRequestBody(encrypted.toString());\n } catch (error) {\n console.error('加密请求参数时出错:', error);\n }\n}",
|
|
799
|
-
"name": "自定义脚本",
|
|
800
|
-
"id": "3a0094827ff006"
|
|
801
|
-
}
|
|
802
|
-
],
|
|
803
|
-
"post_tasks": [
|
|
804
|
-
{
|
|
805
|
-
"type": "customScript",
|
|
806
|
-
"enabled": 1,
|
|
807
|
-
"data": "// This code is generated by [Apipost] AI.\nfunction generateVisualizerScript() {\n try {\n const objData = pm.response.json();\n const template = `\n <style>\n .table { background-color: #FFFFFF; border-radius: 8px; }\n .table th { background-color: #F0F0F0; padding: 10px; border-bottom: 1px solid #DDDDDD; }\n .table td { padding: 10px; border-bottom: 1px solid #DDDDDD; }\n </style>\n <table class=\"table\">\n <thead>\n <tr>\n <th>字段</th>\n <th>值</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>resultcode</td>\n <td>{{resultcode}}</td>\n </tr>\n <tr>\n <td>reason</td>\n <td>{{reason}}</td>\n </tr>\n <tr>\n <td>result</td>\n <td>{{result}}</td>\n </tr>\n <tr>\n <td>error_code</td>\n <td>{{error_code}}</td>\n </tr>\n </tbody>\n </table>\n `;\n pm.visualizer.set(template, objData);\n } catch (e) {\n console.error('生成可视化脚本时出错:', e);\n }\n}\ngenerateVisualizerScript();",
|
|
808
|
-
"name": "自定义脚本",
|
|
809
|
-
"id": "39e9dc0dfff010"
|
|
810
|
-
},
|
|
811
|
-
{
|
|
812
|
-
"type": "customScript",
|
|
813
|
-
"enabled": 1,
|
|
814
|
-
"data": "// 断言响应状态码是否为200\npm.test(\"响应状态码为200\", function () {\n pm.response.to.have.status(200);\n});\n// 断言响应时间是否小于300毫秒(行业推荐平均响应时间)\npm.test(\"响应时间小于300毫秒\", function () {\n pm.expect(pm.response.responseTime).to.be.below(300);\n});\n// 断言响应体中resultcode字段是否为101\npm.test(\"响应体中resultcode字段为101\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.resultcode).to.eql(\"101\");\n});\n// 断言响应体中reason字段是否为错误的请求KEY\npm.test(\"响应体中reason字段为错误的请求KEY\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.reason).to.eql(\"错误的请求KEY\");\n});\n// 断言响应体中error_code字段是否为10001\npm.test(\"响应体中error_code字段为10001\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.error_code).to.eql(10001);\n});\n// 断言响应体是否为有效的JSON格式\npm.test(\"响应体必须是json\", function () {\n pm.response.to.be.json;\n});",
|
|
815
|
-
"name": "AI断言",
|
|
816
|
-
"id": "3a01bc577ff018"
|
|
817
|
-
},
|
|
818
|
-
{
|
|
819
|
-
"type": "customScript",
|
|
820
|
-
"enabled": 1,
|
|
821
|
-
"data": "// 断言响应状态码是否为200\npm.test(\"响应状态码为200\", function () {\n pm.response.to.have.status(200);\n});\n// 断言响应时间是否小于300毫秒(行业推荐平均响应时间)\npm.test(\"响应时间小于300毫秒\", function () {\n pm.expect(pm.response.responseTime).to.be.below(300);\n});\n// 断言响应体中的resultcode是否为101\npm.test(\"响应体中的resultcode为101\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.resultcode).to.eql(\"101\");\n});\n// 断言响应体中的reason是否为错误的请求KEY\npm.test(\"响应体中的reason为错误的请求KEY\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.reason).to.eql(\"错误的请求KEY\");\n});\n// 断言响应体中的error_code是否为10001\npm.test(\"响应体中的error_code为10001\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.error_code).to.eql(10001);\n});",
|
|
822
|
-
"name": "AI Assertion",
|
|
823
|
-
"id": "3a025d25fff008"
|
|
824
|
-
},
|
|
825
|
-
{
|
|
826
|
-
"type": "customScript",
|
|
827
|
-
"enabled": 1,
|
|
828
|
-
"data": "// 断言响应状态码是否为200,通常200表示请求成功\npm.test(\"响应状态码为200\", function () {\n pm.response.to.have.status(200);\n});\n// 断言响应时间是否小于300毫秒,300毫秒是行业推荐的平均响应时间\npm.test(\"响应时间小于300毫秒\", function () {\n pm.expect(pm.response.responseTime).to.be.below(300);\n});\n// 断言响应体中的resultcode字段是否为101\npm.test(\"响应体中的resultcode为101\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.resultcode).to.eql(\"101\");\n});\n// 断言响应体中的reason字段是否为'错误的请求KEY'\npm.test(\"响应体中的reason为错误的请求KEY\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.reason).to.eql(\"错误的请求KEY\");\n});\n// 断言响应体中的error_code字段是否为10001\npm.test(\"响应体中的error_code为10001\", function () {\n var jsonData = pm.response.json();\n pm.expect(jsonData.error_code).to.eql(10001);\n});",
|
|
829
|
-
"name": "AI断言",
|
|
830
|
-
"id": "3a1eabf07ff00c"
|
|
831
|
-
}
|
|
832
|
-
],
|
|
833
|
-
"header": {
|
|
834
|
-
"parameter": [
|
|
835
|
-
{
|
|
836
|
-
"param_id": "38670379f2a15a",
|
|
837
|
-
"description": "请求内容类型",
|
|
838
|
-
"field_type": "string",
|
|
839
|
-
"is_checked": 1,
|
|
840
|
-
"key": "Content-Type",
|
|
841
|
-
"not_null": 1,
|
|
842
|
-
"value": "application/x-www-form-urlencoded",
|
|
843
|
-
"schema": {
|
|
844
|
-
"type": "string"
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
]
|
|
848
|
-
},
|
|
849
|
-
"query": {
|
|
850
|
-
"query_add_equal": 1,
|
|
851
|
-
"parameter": [
|
|
852
|
-
{
|
|
853
|
-
"param_id": "3867057a72a15c",
|
|
854
|
-
"field_type": "string",
|
|
855
|
-
"is_checked": 1,
|
|
856
|
-
"key": "a",
|
|
857
|
-
"not_null": 1,
|
|
858
|
-
"value": "{{a}}",
|
|
859
|
-
"description": "在个人中心->我的数据,接口名称上方查看"
|
|
860
|
-
}
|
|
861
|
-
]
|
|
862
|
-
},
|
|
863
|
-
"cookie": {
|
|
864
|
-
"cookie_encode": 1,
|
|
865
|
-
"parameter": []
|
|
866
|
-
},
|
|
867
|
-
"restful": {
|
|
868
|
-
"parameter": []
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
}
|
|
355
|
+
"target_type": "api"
|
|
872
356
|
}
|
|
873
357
|
}
|
|
874
358
|
]
|