fix: idea插件导入接口定义导致body切换失效

This commit is contained in:
zhangdahai112 2022-02-22 16:11:09 +08:00 committed by zhangdahai112
parent b032ec0313
commit f89be086c4
1 changed files with 6 additions and 0 deletions

View File

@ -119,6 +119,7 @@ import ApiCaseSimpleList from "./list/ApiCaseSimpleList";
import MsApiCaseList from "./case/ApiCaseList";
import {getUUID} from "@/common/js/utils";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import _ from 'lodash';
export default {
name: "EditCompleteContainer",
@ -218,6 +219,11 @@ export default {
if (this.currentApi.request != null && this.currentApi.request != 'null' && this.currentApi.request != undefined) {
if (Object.prototype.toString.call(this.currentApi.request).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
this.currentApi.request = JSON.parse(this.currentApi.request);
if (!this.currentApi.request.body.type) {
let tempRequest = _.cloneDeep(this.currentApi.request);
tempRequest.body = {type: null};
this.currentApi.request = tempRequest;
}
}
}
if (this.currentApi && this.currentApi.request && !this.currentApi.request.hashTree) {