fix(测试跟踪): 修复测试计划报告导出后接口用例响应体不展示的问题

--bug=1021945 --user=宋天阳 【测试跟踪】导出测试计划报告-接口用例-响应体不显示
https://www.tapd.cn/55049933/s/1327149
This commit is contained in:
song-tianyang 2023-01-12 15:42:39 +08:00 committed by 建国
parent c395b120ce
commit 4afdc28053
1 changed files with 6 additions and 1 deletions

View File

@ -439,11 +439,16 @@ public class TestPlanApiCaseService {
try { try {
responseObj = JSON.parseMap(execResult.getContent()); responseObj = JSON.parseMap(execResult.getContent());
} catch (Exception e) { } catch (Exception e) {
LogUtil.error("转换content失败!", e);
} }
if (StringUtils.isNotEmpty(execResult.getEnvConfig())) { if (StringUtils.isNotEmpty(execResult.getEnvConfig())) {
responseObj.put("envName", apiDefinitionService.getEnvNameByEnvConfig(execResult.getProjectId(), execResult.getEnvConfig())); responseObj.put("envName", apiDefinitionService.getEnvNameByEnvConfig(execResult.getProjectId(), execResult.getEnvConfig()));
} }
item.setResponse(responseObj.toString()); /*
* 之前这里的写法是responseObj.toString()
* 猜测是fastjson转换之后只是单纯的把JSONObject改成了map所以这里放进去的不是json格式的数据
*/
item.setResponse(JSON.toJSONString(responseObj));
} }
}); });
} }