fix(接口测试): 修复接口导出时响应体状态码描述信息导出失败问题

--bug=1020795--user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001020795
This commit is contained in:
guoyuqi 2022-12-30 14:47:26 +08:00 committed by xiaomeinvG
parent ce89d69acc
commit 474ea08815
1 changed files with 5 additions and 4 deletions

View File

@ -979,7 +979,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
return new JSONObject(); return new JSONObject();
} }
JSONObject responseBody = new JSONObject(); JSONObject responseBody = new JSONObject();
JSONObject statusCodeInfo = new JSONObject();
// build 请求头 // build 请求头
JSONObject headers = new JSONObject(); JSONObject headers = new JSONObject();
JSONArray headValueList = response.optJSONArray("headers"); JSONArray headValueList = response.optJSONArray("headers");
@ -995,13 +995,14 @@ public class Swagger3Parser extends SwaggerAbstractParser {
} }
} }
} }
statusCodeInfo.put("headers", headers);
statusCodeInfo.put("content", buildContent(response));
statusCodeInfo.put("description", StringUtils.EMPTY);
// 返回code // 返回code
JSONArray statusCode = response.optJSONArray("statusCode"); JSONArray statusCode = response.optJSONArray("statusCode");
for (int i = 0; i < statusCode.length(); i++) { for (int i = 0; i < statusCode.length(); i++) {
JSONObject statusCodeInfo = new JSONObject();
statusCodeInfo.put("headers", headers);
statusCodeInfo.put("content", buildContent(response));
statusCodeInfo.put("description", StringUtils.EMPTY);
JSONObject jsonObject = statusCode.getJSONObject(i); JSONObject jsonObject = statusCode.getJSONObject(i);
jsonObject.get("name"); jsonObject.get("name");
statusCodeInfo.put("description", jsonObject.get("value")); statusCodeInfo.put("description", jsonObject.get("value"));