fix(接口测试): 修复接口定义文档中raw响应体不展示的问题
--bug=1019556 --user=宋天阳 【接口测试】接口定义-文档中的响应体没显示 https://www.tapd.cn/55049933/s/1301054
This commit is contained in:
parent
c7c1b6382e
commit
9b106c7087
|
@ -384,7 +384,12 @@ public class ShareInfoService extends BaseShareInfoService {
|
||||||
} else {
|
} else {
|
||||||
apiInfoDTO.setResponseBodyParamType(type);
|
apiInfoDTO.setResponseBodyParamType(type);
|
||||||
}
|
}
|
||||||
if (StringUtils.equalsAny(type, "JSON", "XML", "Raw")) {
|
if (StringUtils.equalsIgnoreCase(type, "Raw")) {
|
||||||
|
if (bodyObj.has("raw")) {
|
||||||
|
String raw = bodyObj.get("raw").asText();
|
||||||
|
apiInfoDTO.setResponseBodyStructureData(raw);
|
||||||
|
}
|
||||||
|
} else if (StringUtils.equalsAny(type, "JSON", "XML")) {
|
||||||
|
|
||||||
//判断是否是JsonSchema
|
//判断是否是JsonSchema
|
||||||
boolean isJsonSchema = false;
|
boolean isJsonSchema = false;
|
||||||
|
|
|
@ -102,7 +102,7 @@ import MsCodeEdit from 'metersphere-frontend/src/components/MsCodeEdit';
|
||||||
import ApiStatus from '@/business/definition/components/list/ApiStatus';
|
import ApiStatus from '@/business/definition/components/list/ApiStatus';
|
||||||
import MsJsonCodeEdit from '@/business/commons/json-schema/JsonSchemaEditor';
|
import MsJsonCodeEdit from '@/business/commons/json-schema/JsonSchemaEditor';
|
||||||
import ApiRemarkShow from '@/business/definition/components/document/components/ApiRemarkShow';
|
import ApiRemarkShow from '@/business/definition/components/document/components/ApiRemarkShow';
|
||||||
import { generateApiDocumentShareInfo, documentShareUrl } from '@/api/share';
|
import { documentShareUrl, generateApiDocumentShareInfo } from '@/api/share';
|
||||||
import ApiInfoCollapse from '@/business/definition/components/document/components/ApiInfoCollapse';
|
import ApiInfoCollapse from '@/business/definition/components/document/components/ApiInfoCollapse';
|
||||||
import ApiRequestInfo from '@/business/definition/components/document/components/ApiRequestInfo';
|
import ApiRequestInfo from '@/business/definition/components/document/components/ApiRequestInfo';
|
||||||
import ApiResponseInfo from '@/business/definition/components/document/components/ApiResponseInfo';
|
import ApiResponseInfo from '@/business/definition/components/document/components/ApiResponseInfo';
|
||||||
|
@ -210,7 +210,9 @@ export default {
|
||||||
hasResponseBody(apiInfo) {
|
hasResponseBody(apiInfo) {
|
||||||
let hasParams = false;
|
let hasParams = false;
|
||||||
if (apiInfo) {
|
if (apiInfo) {
|
||||||
if (this.formParamTypes.includes(apiInfo.responseBodyParamType)) {
|
if (apiInfo.responseBodyParamType === 'Raw') {
|
||||||
|
hasParams = true;
|
||||||
|
} else if (this.formParamTypes.includes(apiInfo.responseBodyParamType)) {
|
||||||
if (apiInfo.responseBodyFormData && apiInfo.responseBodyFormData !== '无') {
|
if (apiInfo.responseBodyFormData && apiInfo.responseBodyFormData !== '无') {
|
||||||
let jsonArr = JSON.parse(apiInfo.responseBodyFormData);
|
let jsonArr = JSON.parse(apiInfo.responseBodyFormData);
|
||||||
//遍历,把必填项空的数据去掉
|
//遍历,把必填项空的数据去掉
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<br />
|
<br />
|
||||||
<p
|
<p
|
||||||
style="margin: 0px 20px"
|
style="margin: 0px 20px"
|
||||||
v-html="formatRowData(apiInfo.responseBodyParamType, apiInfo.requestBodyStructureData)"></p>
|
v-html="formatRowData(apiInfo.responseBodyParamType, apiInfo.responseBodyStructureData)"></p>
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue