runner-runtime 1.0.65 → 1.0.66
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 +11 -7
- package/package.json +2 -2
- package/tmp/request.js +1 -9
package/events/api.js
CHANGED
|
@@ -38,7 +38,7 @@ const convert2PostmanRequest = (request, option) => {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
// 处理 url
|
|
41
|
-
const raw = autoReplaceMockVar(_.get(request, "
|
|
41
|
+
const raw = autoReplaceMockVar(_.get(request, "url") || _.get(request, "request.url"));
|
|
42
42
|
const uri = new Url(raw);
|
|
43
43
|
|
|
44
44
|
// 清除原有query参数
|
|
@@ -872,8 +872,7 @@ const convert2PostmanEvent = (request, listen, option) => {
|
|
|
872
872
|
// Database
|
|
873
873
|
pm.queryDatabase = async (dbconfig) => {
|
|
874
874
|
const { query } = dbconfig;
|
|
875
|
-
const { createUnixClient } = require('net'),
|
|
876
|
-
socketPath = getMainProcessSocketPath();
|
|
875
|
+
const { createUnixClient } = require('net'), socketPath = getMainProcessSocketPath();
|
|
877
876
|
|
|
878
877
|
try{
|
|
879
878
|
const result = await createUnixClient(socketPath, JSON.stringify({
|
|
@@ -883,7 +882,9 @@ const convert2PostmanEvent = (request, listen, option) => {
|
|
|
883
882
|
|
|
884
883
|
return JSON.parse(Buffer.from(JSON.parse(result.toString())).toString());
|
|
885
884
|
}catch(e){
|
|
886
|
-
|
|
885
|
+
console.error("Database error: " + String(e))
|
|
886
|
+
throw new Error(String(e));
|
|
887
|
+
// return { err: 'error', result:String(e)}
|
|
887
888
|
}
|
|
888
889
|
};
|
|
889
890
|
|
|
@@ -903,10 +904,12 @@ const convert2PostmanEvent = (request, listen, option) => {
|
|
|
903
904
|
if(resultObj?.err == 'success'){
|
|
904
905
|
return resultObj?.result
|
|
905
906
|
}else{
|
|
907
|
+
console.error("pm.execute error: " + String(resultObj?.result))
|
|
906
908
|
throw new Error(resultObj?.result);
|
|
907
909
|
}
|
|
908
910
|
}
|
|
909
911
|
catch (e) {
|
|
912
|
+
console.error("pm.execute error: " + String(e))
|
|
910
913
|
throw new Error(e);
|
|
911
914
|
}
|
|
912
915
|
};
|
|
@@ -2033,6 +2036,7 @@ const initRequestJson = (event, option) => {
|
|
|
2033
2036
|
|
|
2034
2037
|
// 获取前置url
|
|
2035
2038
|
let envPreUrl = _.trim(_.get(requestJson, 'pre_url', ''));
|
|
2039
|
+
|
|
2036
2040
|
if (envPreUrl == '') {
|
|
2037
2041
|
envPreUrl = _.trim(_.get(_.find(_.get(option, `env.env_pre_urls`), (server) => {
|
|
2038
2042
|
return server?.server_id == envServerID;
|
|
@@ -2050,7 +2054,7 @@ const initRequestJson = (event, option) => {
|
|
|
2050
2054
|
_.set(requestJson, "url", smartUrlJoin(envPreUrl, requestUrl));
|
|
2051
2055
|
}
|
|
2052
2056
|
}
|
|
2053
|
-
|
|
2057
|
+
|
|
2054
2058
|
// 设置 initVarReplacedUrl
|
|
2055
2059
|
let initVarReplacedUrl = requestJson?.url;
|
|
2056
2060
|
_.forEach(_.assign({}, globals, _.get(env, 'environment')), (value, key) => {
|
|
@@ -2279,7 +2283,7 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
|
|
|
2279
2283
|
)
|
|
2280
2284
|
}
|
|
2281
2285
|
}
|
|
2282
|
-
|
|
2286
|
+
|
|
2283
2287
|
const requestOptions = convert2EchoRequest(request, requestJson, postmanJSON, history);
|
|
2284
2288
|
_.set(eventRuntimeData, [event?.event_id, "request"], requestOptions);
|
|
2285
2289
|
|
|
@@ -2404,7 +2408,7 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
|
|
|
2404
2408
|
event_id: event?.event_id,
|
|
2405
2409
|
}
|
|
2406
2410
|
);
|
|
2407
|
-
|
|
2411
|
+
|
|
2408
2412
|
if (scene === 'auto_test' || requestJson?.target_type === 'sse') { // 纯粹为了兼容老的数据返回格式 todo...
|
|
2409
2413
|
if (_.includes(['assert', 'assert_visual', 'api', 'sample', 'script', 'sql'], event?.type)) {
|
|
2410
2414
|
eventResultList.push(_.assign(camelCaseToSnakeCase(_.get(_.cloneDeep(eventRuntimeData), event?.event_id)), _.pick(event, ['type', 'event_id', 'test_id', 'iteration_id'])));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "runner-runtime",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.66",
|
|
4
4
|
"description": "runner-runtime.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"msgpack5": "^6.0.2",
|
|
41
41
|
"net": "^1.0.2",
|
|
42
42
|
"postman-collection": "^5.0.2",
|
|
43
|
-
"postman-runtime-pro": "^7.43.
|
|
43
|
+
"postman-runtime-pro": "^7.43.18",
|
|
44
44
|
"request-har": "^1.0.0",
|
|
45
45
|
"strip-json-comments": "^3.1.1",
|
|
46
46
|
"tough": "^0.6.0",
|
package/tmp/request.js
CHANGED
|
@@ -194,15 +194,7 @@ module.exports ={
|
|
|
194
194
|
"auth": {
|
|
195
195
|
"type": "inherit"
|
|
196
196
|
},
|
|
197
|
-
"pre_tasks": [
|
|
198
|
-
{
|
|
199
|
-
"type": "customScript",
|
|
200
|
-
"id": "f5f4d853d640b",
|
|
201
|
-
"name": "自定义脚本",
|
|
202
|
-
"enabled": 1,
|
|
203
|
-
"data": "console.log(a)"
|
|
204
|
-
}
|
|
205
|
-
],
|
|
197
|
+
"pre_tasks": [],
|
|
206
198
|
"post_tasks": [],
|
|
207
199
|
"body": {
|
|
208
200
|
"parameter": []
|