fix(接口测试): 引用的接口用例body参数显示有误

--bug=1041173 --user=陈建星 【接口测试】场景-引用API-请求体为form-data/binary-类型为file-上传的文件修改后保存场景退出-再打开场景,文件还是旧文件 https://www.tapd.cn/55049933/s/1532571
This commit is contained in:
AgAngle 2024-06-21 10:45:16 +08:00 committed by Craftsman
parent ebff9badcc
commit 16ece7b459
1 changed files with 5 additions and 9 deletions

View File

@ -83,17 +83,13 @@ public class ApiStepParser extends StepParser {
if (refBody == null || valueBody == null) { if (refBody == null || valueBody == null) {
return; return;
} }
refBody.setBodyType(valueBody.getBodyType()); if (valueBody.getFormDataBody() != null && refBody.getFormDataBody() != null) {
if (StringUtils.equals(refBody.getBodyType(), Body.BodyType.FORM_DATA.name()) && replaceKvParam(valueBody.getFormDataBody().getFormValues(), refBody.getFormDataBody().getFormValues());
valueBody.getFormDataBody() != null && refBody.getFormDataBody() != null) {
replaceKvParam(valueBody.getFormDataBody().getFormValues(), valueBody.getFormDataBody().getFormValues());
} }
if (StringUtils.equals(refBody.getBodyType(), Body.BodyType.WWW_FORM.name()) && if (valueBody.getWwwFormBody() != null && refBody.getWwwFormBody() != null) {
valueBody.getWwwFormBody() != null && refBody.getWwwFormBody() != null) { replaceKvParam(valueBody.getWwwFormBody().getFormValues(), refBody.getWwwFormBody().getFormValues());
replaceKvParam(valueBody.getWwwFormBody().getFormValues(), valueBody.getWwwFormBody().getFormValues());
} }
if (StringUtils.equals(refBody.getBodyType(), Body.BodyType.BINARY.name()) && if (valueBody.getBinaryBody() != null && refBody.getBinaryBody() != null) {
valueBody.getBinaryBody() != null && refBody.getBinaryBody() != null) {
refBody.getBinaryBody().setFile(valueBody.getBinaryBody().getFile()); refBody.getBinaryBody().setFile(valueBody.getBinaryBody().getFile());
} }
// todo JsonSchema body // todo JsonSchema body