fix(接口测试): 引用的接口定义,修改binaryBody参数不生效

--bug=1041173 --user=陈建星 【接口测试】场景-引用API-请求体为form-data/binary-类型为file-上传的文件修改后保存场景退出-再打开场景,文件还是旧文件 https://www.tapd.cn/55049933/s/1522093
This commit is contained in:
AgAngle 2024-05-28 14:57:12 +08:00 committed by jianxing
parent e42c1d76e6
commit d387202f78
2 changed files with 7 additions and 2 deletions

View File

@ -91,6 +91,10 @@ public class ApiStepParser extends StepParser {
valueBody.getWwwFormBody() != null && refBody.getWwwFormBody() != null) {
replaceKvParam(valueBody.getWwwFormBody().getFormValues(), valueBody.getWwwFormBody().getFormValues());
}
if (StringUtils.equals(refBody.getBodyType(), Body.BodyType.BINARY.name()) &&
valueBody.getBinaryBody() != null && refBody.getBinaryBody() != null) {
refBody.getBinaryBody().setFile(valueBody.getBinaryBody().getFile());
}
// todo JsonSchema body
}

View File

@ -639,8 +639,9 @@ public class ApiScenarioControllerTests extends BaseTest {
Map<String, Object> steptDetailMap = new HashMap<>();
MsHTTPElement msHttpElement = MsHTTPElementTest.getMsHttpElement();
msHttpElement.setBody(ApiDebugControllerTests.addBodyLinkFile(msHttpElement.getBody(), fileMetadataId));
steptDetailMap.put(steps.get(0).getId(), getMsHttpElementStr(msHttpElement));
steptDetailMap.put(steps.get(1).getId(), getMsHttpElementStr(msHttpElement));
for (ApiScenarioStepRequest step : steps) {
steptDetailMap.put(step.getId(), getMsHttpElementStr(msHttpElement));
}
fileMetadataStepId = steps.get(0).getId();
request.setSteps(steps);