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 {
|
||||
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
|
||||
boolean isJsonSchema = false;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<el-popover v-if="projectId" placement="right" width="260" @show="shareApiDocument('false')">
|
||||
<p>{{ shareUrl }}</p>
|
||||
<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>
|
||||
<i class="el-icon-share" slot="reference" style="margin-right: 10px; cursor: pointer"></i>
|
||||
</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('commons.create_user') }} : {{ apiInfo.createUser }}</el-col>
|
||||
</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>
|
||||
</el-row>
|
||||
<!--api请求头-->
|
||||
|
@ -102,7 +102,7 @@ import MsCodeEdit from 'metersphere-frontend/src/components/MsCodeEdit';
|
|||
import ApiStatus from '@/business/definition/components/list/ApiStatus';
|
||||
import MsJsonCodeEdit from '@/business/commons/json-schema/JsonSchemaEditor';
|
||||
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 ApiRequestInfo from '@/business/definition/components/document/components/ApiRequestInfo';
|
||||
import ApiResponseInfo from '@/business/definition/components/document/components/ApiResponseInfo';
|
||||
|
@ -210,7 +210,9 @@ export default {
|
|||
hasResponseBody(apiInfo) {
|
||||
let hasParams = false;
|
||||
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 !== '无') {
|
||||
let jsonArr = JSON.parse(apiInfo.responseBodyFormData);
|
||||
//遍历,把必填项空的数据去掉
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<br />
|
||||
<p
|
||||
style="margin: 0px 20px"
|
||||
v-html="formatRowData(apiInfo.responseBodyParamType, apiInfo.requestBodyStructureData)"></p>
|
||||
v-html="formatRowData(apiInfo.responseBodyParamType, apiInfo.responseBodyStructureData)"></p>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue