fix(接口测试): 修复mock响应跟随API定义后再切换raw格式,无法编辑响应体的问题
--bug=1010364 --user=宋天阳 【接口测试】mock响应跟随API定义后再切换raw格式,无法编辑响应体 https://www.tapd.cn/55049933/s/1106633
This commit is contained in:
parent
587ceb7329
commit
72abd2100b
|
@ -81,7 +81,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="showMock && (currentProtocol === 'HTTP' || currentProtocol === 'TCP')">
|
<div v-if="showMock && (currentProtocol === 'HTTP' || currentProtocol === 'TCP')">
|
||||||
<mock-tab :base-mock-config-data="baseMockConfigData" @redirectToTest="redirectToTest"
|
<mock-tab :base-mock-config-data="baseMockConfigData" @redirectToTest="redirectToTest" :version-name="currentApi.versionName"
|
||||||
:is-tcp="currentProtocol === 'TCP'"/>
|
:is-tcp="currentProtocol === 'TCP'"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="showTestCaseList">
|
<div v-if="showTestCaseList">
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
:read-only="isReadOnly"
|
:read-only="isReadOnly"
|
||||||
:data.sync="body.raw"
|
:data.sync="body.raw"
|
||||||
:modes="modes"
|
:modes="modes"
|
||||||
|
v-if="loadIsOver"
|
||||||
height="90%"
|
height="90%"
|
||||||
ref="codeEdit"/>
|
ref="codeEdit"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -257,7 +258,7 @@ export default {
|
||||||
let selectUrl = "/mockConfig/getApiResponse/" + this.apiId;
|
let selectUrl = "/mockConfig/getApiResponse/" + this.apiId;
|
||||||
this.$get(selectUrl, response => {
|
this.$get(selectUrl, response => {
|
||||||
let apiResponse = response.data;
|
let apiResponse = response.data;
|
||||||
if (apiResponse && apiResponse.returnMsg) {
|
if (apiResponse && apiResponse.returnData) {
|
||||||
this.body.apiRspRaw = apiResponse.returnData;
|
this.body.apiRspRaw = apiResponse.returnData;
|
||||||
}
|
}
|
||||||
this.refreshMsCodeEdit();
|
this.refreshMsCodeEdit();
|
||||||
|
|
|
@ -179,7 +179,7 @@ export default {
|
||||||
if (laguanges === "python") {
|
if (laguanges === "python") {
|
||||||
returnScript = 'param=vars["body.${param}"]';
|
returnScript = 'param=vars["body.${param}"]';
|
||||||
} else {
|
} else {
|
||||||
returnScript = 'var param=vars.get(body.${param}")\n' +
|
returnScript = 'var param=vars.get(body.${param}");\n' +
|
||||||
'//如果对象是多层JSON,需要引入fastjson协助解析:\n' +
|
'//如果对象是多层JSON,需要引入fastjson协助解析:\n' +
|
||||||
'// 以"{\"name\":\"user\",\"rows\":[{\"type\":1}]}" 为demo,取rows第1个的type数据:\n' +
|
'// 以"{\"name\":\"user\",\"rows\":[{\"type\":1}]}" 为demo,取rows第1个的type数据:\n' +
|
||||||
'import com.alibaba.fastjson.JSON;\n' +
|
'import com.alibaba.fastjson.JSON;\n' +
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
</el-collapse-transition>
|
</el-collapse-transition>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="response.usePostScript">
|
<div v-show="response.usePostScript">
|
||||||
<el-row style="margin-top: 10px;">
|
<el-row style="margin-top: 10px;">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<p class="tip">{{ $t('api_test.definition.request.post_script') }}</p>
|
<p class="tip">{{ $t('api_test.definition.request.post_script') }}</p>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<div class="ms-opt-btn" v-if="versionEnable">
|
<div class="ms-opt-btn" v-if="versionEnable">
|
||||||
{{ $t('project.version.name') }}: {{ mockConfigData.versionName }}
|
{{ $t('project.version.name') }}: {{ versionName }}
|
||||||
</div>
|
</div>
|
||||||
<el-input :placeholder="$t('commons.search_by_name')" class="search-input" size="small"
|
<el-input :placeholder="$t('commons.search_by_name')" class="search-input" size="small"
|
||||||
:clearable="true"
|
:clearable="true"
|
||||||
|
@ -95,6 +95,7 @@ export default {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
baseMockConfigData: {},
|
baseMockConfigData: {},
|
||||||
|
versionName:String,
|
||||||
isTcp: {
|
isTcp: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
|
|
|
@ -65,6 +65,8 @@
|
||||||
},
|
},
|
||||||
mode() {
|
mode() {
|
||||||
this.format();
|
this.format();
|
||||||
|
},
|
||||||
|
readOnly(){
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
Loading…
Reference in New Issue