fix(接口测试): 修复接口case请求体json格式打开JSON-SCHEMA后浏览器崩溃

This commit is contained in:
RubyLiu 2023-07-26 17:17:54 +08:00 committed by fit2-zhao
parent afb8f55fba
commit db77298ff8

View File

@ -106,7 +106,6 @@ import BatchAddParameter from '../basis/BatchAddParameter';
import Convert from '@/business/commons/json-schema/convert/convert';
import { getApiParamsConfigFields } from 'metersphere-frontend/src/utils/custom_field';
import ApiParamsConfig from '@/business/definition/components/request/components/ApiParamsConfig';
import { jsonParse } from '@/business/commons/json-schema/convert/jsonParse'
export default {
name: 'MsApiBody',
@ -282,11 +281,9 @@ export default {
if (this.body.format === 'JSON-SCHEMA') {
if (this.body.raw) {
try {
const isJson = JSON.parse(this.body.raw);
if(isJson) {
const jsonObj = jsonParse(this.body.raw)
let JSONBig = require('json-bigint')({ storeAsString: true });
const jsonObj = JSONBig.parse(this.body.raw)
this.body.jsonSchema = MsConvert.format(jsonObj);
}
} catch (e) {
this.body.format = 'JSON';
this.$message.error(this.$t('api_definition.body.json_format_error'));