fix(接口自动化): 修复jmx导出消息体数据类型设置错误问题

This commit is contained in:
fit2-zhao 2021-03-25 17:53:26 +08:00
parent 5379c8b763
commit c43a258780
3 changed files with 10 additions and 3 deletions

View File

@ -137,7 +137,7 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
HTTPSamplerProxy source = (HTTPSamplerProxy) key;
BeanUtils.copyBean(samplerProxy, source);
if (source != null && source.getHTTPFiles().length > 0) {
samplerProxy.getBody().setBinary(new ArrayList<>());
samplerProxy.getBody().initBinary();
samplerProxy.getBody().setType(Body.FORM_DATA);
List<KeyValue> keyValues = new LinkedList<>();
for (HTTPFileArg arg : source.getHTTPFiles()) {
@ -153,8 +153,13 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
keyValue.setFiles(files);
keyValues.add(keyValue);
}
if (source.getPostBodyRaw() && CollectionUtils.isNotEmpty(keyValues)) {
samplerProxy.getBody().setType(Body.RAW);
samplerProxy.getBody().setRaw(keyValues.get(0).getValue());
} else {
samplerProxy.getBody().setKvs(keyValues);
}
}
samplerProxy.setProtocol(RequestType.HTTP);
samplerProxy.setPort(source.getPort() + "");
if (source.getArguments() != null) {
@ -173,6 +178,7 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
samplerProxy.setArguments(keyValues);
}
}
samplerProxy.getBody().initBinary();
}
samplerProxy.setPath("");
samplerProxy.setMethod(source.getMethod());

View File

@ -74,6 +74,7 @@ public class Body {
}
}
KeyValue keyValue = new KeyValue("", "JSON-SCHEMA", this.getRaw(), true, true);
sampler.setPostBodyRaw(true);
keyValue.setEnable(true);
keyValue.setEncode(false);
body.add(keyValue);

@ -1 +1 @@
Subproject commit 2115bd28a90854d2b6276a90878934715498c584
Subproject commit 07951ba17aef6f29e50cfd68e40de3266f9a60cd