diff --git a/api-test/frontend/src/business/commons/MsDropdown.vue b/api-test/frontend/src/business/commons/MsDropdown.vue index 7ff49490ba..2b737839b3 100644 --- a/api-test/frontend/src/business/commons/MsDropdown.vue +++ b/api-test/frontend/src/business/commons/MsDropdown.vue @@ -37,6 +37,11 @@ export default { this.currentCommand = this.commands[0]; } }, + watch: { + defaultCommand(val) { + this.currentCommand = val; + }, + }, methods: { handleCommand(command) { this.currentCommand = command; diff --git a/api-test/frontend/src/business/definition/components/response/ResponseResult.vue b/api-test/frontend/src/business/definition/components/response/ResponseResult.vue index 5766d966d3..8c9e2fa8d5 100644 --- a/api-test/frontend/src/business/definition/components/response/ResponseResult.vue +++ b/api-test/frontend/src/business/definition/components/response/ResponseResult.vue @@ -179,6 +179,23 @@ export default { } }); } + if (this.response && this.response.responseResult && this.response.responseResult.contentType) { + switch (this.response.responseResult.contentType) { + case 'application/json': + this.mode = BODY_FORMAT.JSON; + break; + case 'text/html': + this.mode = BODY_FORMAT.HTML; + break; + case 'text/xml': + this.mode = BODY_FORMAT.XML; + break; + default: + this.mode = BODY_FORMAT.TEXT; + break; + } + } + this.msCodeReload(); }, msCodeReload() { this.isMsCodeEditShow = false; diff --git a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/jmeter/JMeterBase.java b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/jmeter/JMeterBase.java index eb2647df8f..963a9080a8 100644 --- a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/jmeter/JMeterBase.java +++ b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/jmeter/JMeterBase.java @@ -107,11 +107,11 @@ public class JMeterBase { //判断返回的类型是否是图片 LoggerUtil.info("返回内容类型为【" + result.getContentType() + "】"); if (StringUtils.isNotEmpty(result.getContentType()) && imageList.contains(result.getContentType())) { - responseResult.setContentType(result.getContentType()); responseResult.setImageUrl(result.getResponseData()); } responseResult.setBody(result.getResponseDataAsString()); } + responseResult.setContentType(result.getContentType()); responseResult.setHeaders(result.getResponseHeaders()); responseResult.setLatency(result.getLatency()); responseResult.setResponseCode(result.getResponseCode());