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;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<el-popover v-if="projectId" placement="right" width="260" @show="shareApiDocument('false')">
|
<el-popover v-if="projectId" placement="right" width="260" @show="shareApiDocument('false')">
|
||||||
<p>{{ shareUrl }}</p>
|
<p>{{ shareUrl }}</p>
|
||||||
<div style="text-align: right; margin: 0">
|
<div style="text-align: right; margin: 0">
|
||||||
<el-button type="primary" size="mini" v-clipboard:copy="shareUrl">{{ $t('commons.copy') }} </el-button>
|
<el-button type="primary" size="mini" v-clipboard:copy="shareUrl">{{ $t('commons.copy') }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
<i class="el-icon-share" slot="reference" style="margin-right: 10px; cursor: pointer"></i>
|
<i class="el-icon-share" slot="reference" style="margin-right: 10px; cursor: pointer"></i>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
<el-col :span="6">{{ $t('api_test.definition.request.responsible') }} : {{ apiInfo.responsibler }}</el-col>
|
<el-col :span="6">{{ $t('api_test.definition.request.responsible') }} : {{ apiInfo.responsibler }}</el-col>
|
||||||
<el-col :span="6">{{ $t('commons.create_user') }} : {{ apiInfo.createUser }}</el-col>
|
<el-col :span="6">{{ $t('commons.create_user') }} : {{ apiInfo.createUser }}</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row style="margin-top: 10px"> {{ $t('commons.description') }} : {{ apiInfo.desc }} </el-row>
|
<el-row style="margin-top: 10px"> {{ $t('commons.description') }} : {{ apiInfo.desc }}</el-row>
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
<!--api请求头-->
|
<!--api请求头-->
|
||||||
|
@ -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