fix(接口测试): 修复Mock-json格式错误时不报JSON错误
This commit is contained in:
parent
0b6210d9e4
commit
aef1c260d0
|
@ -196,8 +196,14 @@ export default {
|
|||
const MsConvert = new Convert();
|
||||
|
||||
if (this.body.format === 'JSON-SCHEMA') {
|
||||
if (this.body.raw && !this.body.jsonSchema) {
|
||||
this.body.jsonSchema = MsConvert.format(JSON.parse(this.body.raw));
|
||||
if (this.body.raw) {
|
||||
try {
|
||||
const jsonObj = JSON.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'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.body.jsonSchema) {
|
||||
|
|
Loading…
Reference in New Issue