runner-runtime 1.0.81 → 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.
- package/events/api.js +34 -1
- package/package.json +1 -1
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(){
|