Skip to content

Commit bf67520

Browse files
committed
3.0.8
1.修复接口编辑里raw类型切换的bug 2.在接口注入里添加了param对象 3.修复了自动化测试后台轮询报错的bug 4.修复了接口返回为数组不能生成数组模型的bug
1 parent a36beaf commit bf67520

File tree

12 files changed

+86
-103
lines changed

12 files changed

+86
-103
lines changed

Client/dist/vendor.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Client/dist/vendor.bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Client/web/component/inparamBody.vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,7 @@
150150
return type;
151151
},
152152
set:function (value) {
153-
if(value=="file")
154-
{
155-
this.info.rawType=1;
156-
}
157-
else if(value=="application/json")
153+
if(value=="application/json")
158154
{
159155
this.info.rawType=2;
160156
var bFind=false,objIndex;
@@ -177,7 +173,14 @@
177173
}
178174
else
179175
{
180-
this.info.rawType=0;
176+
if(value=="file")
177+
{
178+
this.info.rawType=1;
179+
}
180+
else
181+
{
182+
this.info.rawType=0;
183+
}
181184
var bFind=false,objIndex;
182185
this.$store.state.header.forEach(function (obj,index) {
183186
if(obj.name && obj.name.toLowerCase()=="content-type")
@@ -187,7 +190,7 @@
187190
bFind=true;
188191
}
189192
})
190-
if(value=="")
193+
if(value=="" || value=="file")
191194
{
192195
if(bFind)
193196
{

Client/web/component/runBody.vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,7 @@
207207
return type;
208208
},
209209
set:function (value) {
210-
if(value=="file")
211-
{
212-
this.info.rawType=1;
213-
}
214-
else if(value=="application/json")
210+
if(value=="application/json")
215211
{
216212
this.info.rawType=2;
217213
var bFind=false,objIndex;
@@ -234,7 +230,14 @@
234230
}
235231
else
236232
{
237-
this.info.rawType=0;
233+
if(value=="file")
234+
{
235+
this.info.rawType=1;
236+
}
237+
else
238+
{
239+
this.info.rawType=0;
240+
}
238241
var bFind=false,objIndex;
239242
this.$store.state.header.forEach(function (obj,index) {
240243
if(obj.name && obj.name.toLowerCase()=="content-type")
@@ -244,7 +247,7 @@
244247
bFind=true;
245248
}
246249
})
247-
if(value=="")
250+
if(value=="" || value=="file")
248251
{
249252
if(bFind)
250253
{

Client/web/projectinfo/inject.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ <h2>
1818
url:BaseUrl字符串<br>
1919
path:path路径字符串<br>
2020
method:HTTP方法字符串<br>
21+
param:Object对象,里面存放了Param的数据<br>
2122
query:Object对象,里面存放了Query的数据<br>
2223
header:Object对象,里面存放了Header的数据<br>
2324
body:Object对象,里面存放了Body的数据<br>

Client/web/projectinfo/storeRun.js

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -700,11 +700,9 @@ module.exports=new Vuex.Store({
700700
baseUrl=config.baseUrl;
701701
path="/mock/"+sessionStorage.getItem("projectId")+(path[0]!="/"?("/"+path):path);
702702
}
703+
var param={};
703704
context.state.param.forEach(function (obj) {
704-
if(obj.name)
705-
{
706-
path=path.replace("{"+obj.name+"}",obj.selValue)
707-
}
705+
param[obj.name]=obj.selValue;
708706
})
709707
var query={};
710708
context.getters.querySave.forEach(function (obj) {
@@ -844,17 +842,22 @@ module.exports=new Vuex.Store({
844842
}
845843
}
846844
}
845+
847846
if(context.state.interface.before.mode==0)
848847
{
849848
if(context.state.globalBefore)
850849
{
851-
helper.runBefore(context.state.globalBefore,baseUrl,path,method,query,header,body)
850+
helper.runBefore(context.state.globalBefore,baseUrl,path,method,query,header,body,param)
852851
}
853-
helper.runBefore(context.state.interface.before.code,baseUrl,path,method,query,header,body)
852+
helper.runBefore(context.state.interface.before.code,baseUrl,path,method,query,header,body,param)
854853
}
855854
else
856855
{
857-
helper.runBefore(context.state.interface.before.code,baseUrl,path,method,query,header,body)
856+
helper.runBefore(context.state.interface.before.code,baseUrl,path,method,query,header,body,param)
857+
}
858+
for(var paramKey in param)
859+
{
860+
path=path.replace("{"+paramKey+"}",param[paramKey])
858861
}
859862
if((method=="POST" || method=="PUT" || method=="PATCH") && context.state.bodyInfo.type==1 && context.state.bodyInfo.rawType==2)
860863
{
@@ -1069,10 +1072,18 @@ module.exports=new Vuex.Store({
10691072
var result=[];
10701073
if(context.state.resultData)
10711074
{
1072-
for(var key in context.state.resultData)
1075+
if((context.state.resultData instanceof Array) && context.state.resultData.length>0)
10731076
{
10741077
var resultObj=helper.findObj(context.state.interface.outParam,key);
1075-
helper.handleResultData(key,context.state.resultData[key],result,resultObj)
1078+
helper.handleResultData(key,context.state.resultData[0],result,resultObj)
1079+
}
1080+
else
1081+
{
1082+
for(var key in context.state.resultData)
1083+
{
1084+
var resultObj=helper.findObj(context.state.interface.outParam,key);
1085+
helper.handleResultData(key,context.state.resultData[key],result,resultObj)
1086+
}
10761087
}
10771088
}
10781089
var outInfo;
@@ -1082,6 +1093,7 @@ module.exports=new Vuex.Store({
10821093
type:0,
10831094
rawRemark:"",
10841095
rawMock:"",
1096+
jsonType:(context.state.resultData && (context.state.resultData instanceof Array))?1:0
10851097
}
10861098
}
10871099
else
@@ -1090,7 +1102,7 @@ module.exports=new Vuex.Store({
10901102
type:1,
10911103
rawRemark:context.state.interface.outInfo?context.state.interface.outInfo.rawRemark:"",
10921104
rawMock:context.state.interface.outInfo?context.state.interface.outInfo.rawMock:"",
1093-
jsonType:(context.state.resultData && (context.state.resultData instanceof Array))?1:0
1105+
jsonType:0
10941106
}
10951107
}
10961108
var obj={

Client/web/util/helper.js

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ helper.encrypt=function (type,val,salt) {
11561156
return val;
11571157
}
11581158

1159-
helper.runBefore=function (code,url,path,method,query,header,body) {
1159+
helper.runBefore=function (code,url,path,method,query,header,body,param) {
11601160
var Base64=BASE64.encoder,MD5=CryptoJS.MD5,SHA1=CryptoJS.SHA1,SHA256=CryptoJS.SHA256,SHA512=CryptoJS.SHA512,SHA3=CryptoJS.SHA3,RIPEMD160=CryptoJS.RIPEMD160,AES=CryptoJS.AES.encrypt,TripleDES=CryptoJS.TripleDES.encrypt,DES=CryptoJS.DES.encrypt,Rabbit=CryptoJS.Rabbit.encrypt,RC4=CryptoJS.RC4.encrypt,RC4Drop=CryptoJS.RC4Drop.encrypt;
11611161
try
11621162
{
@@ -1705,39 +1705,9 @@ helper.runTest=async function (obj,baseUrl,global,test,root,opt) {
17051705
}
17061706
}
17071707
var objParam=$.clone(obj.restParam);
1708-
if(opt && opt.param)
1709-
{
1710-
var arr=[];
1711-
for(var key in opt.param)
1712-
{
1713-
var val=opt.param[key];
1714-
var objItem;
1715-
objParam.forEach(function (obj) {
1716-
if(obj.name==key)
1717-
{
1718-
objItem=obj;
1719-
}
1720-
})
1721-
if(objItem)
1722-
{
1723-
objItem.selValue=val;
1724-
}
1725-
else
1726-
{
1727-
arr.push({
1728-
name:key,
1729-
remark:"",
1730-
selValue:val
1731-
})
1732-
}
1733-
}
1734-
objParam=objParam.concat(arr);
1735-
}
1708+
var param={};
17361709
objParam.forEach(function (obj) {
1737-
if(obj.name)
1738-
{
1739-
path=path.replace("{"+obj.name+"}",obj.selValue)
1740-
}
1710+
param[obj.name]=obj.selValue;
17411711
})
17421712
var query={};
17431713
obj.queryParam.forEach(function (obj) {
@@ -1921,13 +1891,25 @@ helper.runTest=async function (obj,baseUrl,global,test,root,opt) {
19211891
{
19221892
if(global.before)
19231893
{
1924-
helper.runBefore(global.before,baseUrl,path,method,query,header,body)
1894+
helper.runBefore(global.before,baseUrl,path,method,query,header,body,param)
19251895
}
1926-
helper.runBefore(obj.before.code,baseUrl,path,method,query,header,body)
1896+
helper.runBefore(obj.before.code,baseUrl,path,method,query,header,body,param)
19271897
}
19281898
else
19291899
{
1930-
helper.runBefore(obj.before.code,baseUrl,path,method,query,header,body)
1900+
helper.runBefore(obj.before.code,baseUrl,path,method,query,header,body,param)
1901+
}
1902+
if(opt && opt.param)
1903+
{
1904+
for(var key in opt.param)
1905+
{
1906+
var val=opt.param[key];
1907+
param[key]=val;
1908+
}
1909+
}
1910+
for(var paramKey in param)
1911+
{
1912+
path=path.replace("{"+paramKey+"}",param[paramKey])
19311913
}
19321914
if(opt && opt.query)
19331915
{

0 commit comments

Comments
 (0)