runner-runtime 1.0.80 → 1.0.82

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.
Files changed (3) hide show
  1. package/events/api.js +34 -1
  2. package/package.json +2 -2
  3. package/tmp/request.js +115 -2279
package/events/api.js CHANGED
@@ -145,7 +145,7 @@ const convert2PostmanRequest = (request, option) => {
145
145
  // 处理 method
146
146
  let method = _.get(request, "method") || "GET";
147
147
 
148
- if(_.includes(['CONNECT'],_.toUpper(method))){
148
+ if (_.includes(['CONNECT'], _.toUpper(method))) {
149
149
  method = 'GET';
150
150
  }
151
151
 
@@ -1355,6 +1355,21 @@ const convert2PostmanEvent = (request, listen, option) => {
1355
1355
  !(function(){
1356
1356
  `
1357
1357
  switch (item.data?.source) {
1358
+ case "requestHeader":
1359
+ exec = `${exec}\n
1360
+ let varSource = request?.headers;
1361
+ `;
1362
+ break;
1363
+ case "requestBody":
1364
+ exec = `${exec}\n
1365
+ let varSource = request?.request_bodys;
1366
+ if(typeof varSource === 'string'){
1367
+ try{
1368
+ varSource = JSON5.parse(varSource)
1369
+ }catch(e){}
1370
+ }
1371
+ `;
1372
+ break;
1358
1373
  case "responseJson":
1359
1374
  exec = `${exec}\n
1360
1375
  let varSource = '';
@@ -1402,6 +1417,24 @@ const convert2PostmanEvent = (request, listen, option) => {
1402
1417
  _.forEach(item.data?.variables, (varItem) => {
1403
1418
  if (_.isObject(varItem) && varItem?.name != "" && !_.isUndefined(varTypeMap[varItem?.type])) {
1404
1419
  switch (item.data?.source) {
1420
+ case 'requestHeader':
1421
+ exec = `${exec}\n
1422
+ !(function(){
1423
+ let pickVars = ${JSON.stringify(varItem)};
1424
+ try{
1425
+ pm[${JSON.stringify(varTypeMap[varItem?.type])}].set(_.get(pickVars,"name"), varSource.get(_.trim(_.get(pickVars,"expression"))));
1426
+ }catch(e){}
1427
+ })();
1428
+ `;
1429
+ break;
1430
+ case 'requestBody':
1431
+ exec = `${exec}\n
1432
+ !(function(){
1433
+ let pickVars = ${JSON.stringify(varItem)};
1434
+ pm[${JSON.stringify(varTypeMap[varItem?.type])}].set(_.get(pickVars,"name"), jsonpath.value(varSource, _.trim(_.get(pickVars,"expression")) || "$"));
1435
+ })();
1436
+ `;
1437
+ break;
1405
1438
  case "responseJson":
1406
1439
  exec = `${exec}\n
1407
1440
  !(function(){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runner-runtime",
3
- "version": "1.0.80",
3
+ "version": "1.0.82",
4
4
  "description": "runner-runtime.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -37,7 +37,7 @@
37
37
  "mime": "^3.0.0",
38
38
  "minimatch": "^9.0.4",
39
39
  "mockjs5-pro": "^1.0.6",
40
- "json-schema-faker-pro": "^0.5.28",
40
+ "json-schema-faker-pro": "^0.5.29",
41
41
  "exp-mock": "^2.0.17",
42
42
  "msgpack5": "^6.0.2",
43
43
  "net": "^1.0.2",