fix(接口自动化): 迁移的数据执行报错处理
This commit is contained in:
parent
76d8e84341
commit
a64294e86e
|
@ -3,6 +3,7 @@ package io.metersphere.api.dto.scenario;
|
|||
import io.metersphere.api.dto.scenario.request.BodyFile;
|
||||
import io.metersphere.commons.json.JSONSchemaGenerator;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy;
|
||||
import org.apache.jmeter.protocol.http.util.HTTPFileArg;
|
||||
|
@ -81,12 +82,16 @@ public class Body {
|
|||
|
||||
private HTTPFileArg[] httpFileArgs(String requestId) {
|
||||
List<HTTPFileArg> list = new ArrayList<>();
|
||||
this.getKvs().stream().filter(KeyValue::isFile).filter(KeyValue::isEnable).forEach(keyValue -> {
|
||||
setFileArg(list, keyValue.getFiles(), keyValue, requestId);
|
||||
});
|
||||
this.getBinary().stream().filter(KeyValue::isFile).filter(KeyValue::isEnable).forEach(keyValue -> {
|
||||
setFileArg(list, keyValue.getFiles(), keyValue, requestId);
|
||||
});
|
||||
if (CollectionUtils.isNotEmpty(this.getKvs())) {
|
||||
this.getKvs().stream().filter(KeyValue::isFile).filter(KeyValue::isEnable).forEach(keyValue -> {
|
||||
setFileArg(list, keyValue.getFiles(), keyValue, requestId);
|
||||
});
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(this.getBinary())) {
|
||||
this.getBinary().stream().filter(KeyValue::isFile).filter(KeyValue::isEnable).forEach(keyValue -> {
|
||||
setFileArg(list, keyValue.getFiles(), keyValue, requestId);
|
||||
});
|
||||
}
|
||||
return list.toArray(new HTTPFileArg[0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -114,6 +114,7 @@ public class HistoricalDataUpgradeService {
|
|||
}
|
||||
if (request1.getBody() != null && request1.getBody().isOldKV()) {
|
||||
request1.getBody().setType(Body.FORM_DATA);
|
||||
request1.getBody().setBinary(new ArrayList<>());
|
||||
}
|
||||
BeanUtils.copyBean(element, request1);
|
||||
((MsHTTPSamplerProxy) element).setProtocol(RequestType.HTTP);
|
||||
|
|
Loading…
Reference in New Issue