From d3cd2f48435784fc3a26ae71126833521e1edc75 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 31 Dec 2020 10:44:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8D=E6=89=A7=E8=A1=8C=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=B8=BA=E7=A9=BA=E6=97=B6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../definition/request/sampler/MsHTTPSamplerProxy.java | 10 ++++++---- .../definition/components/response/RequestMetric.vue | 2 +- .../definition/components/response/ResponseResult.vue | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java index 2c3b7d0f98..4770e79c04 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java @@ -181,11 +181,13 @@ public class MsHTTPSamplerProxy extends MsTestElement { } // 请求体 if (!StringUtils.equals(this.getMethod(), "GET")) { - List bodyParams = this.body.getBodyParams(sampler, this.getId()); - if (this.body.getType().equals("Form Data")) { - sampler.setDoMultipart(true); + if (this.body != null) { + List bodyParams = this.body.getBodyParams(sampler, this.getId()); + if (StringUtils.isNotEmpty(this.body.getType()) && this.body.getType().equals("Form Data")) { + sampler.setDoMultipart(true); + } + sampler.setArguments(httpArguments(bodyParams)); } - sampler.setArguments(httpArguments(bodyParams)); } final HashTree httpSamplerTree = tree.add(sampler); diff --git a/frontend/src/business/components/api/definition/components/response/RequestMetric.vue b/frontend/src/business/components/api/definition/components/response/RequestMetric.vue index cb504b5703..660da3ecae 100644 --- a/frontend/src/business/components/api/definition/components/response/RequestMetric.vue +++ b/frontend/src/business/components/api/definition/components/response/RequestMetric.vue @@ -27,7 +27,7 @@ computed: { error() { - return this.response.responseCode >= 400; + return this.response && this.response.responseCode && this.response.responseCode >= 400; } } } diff --git a/frontend/src/business/components/api/definition/components/response/ResponseResult.vue b/frontend/src/business/components/api/definition/components/response/ResponseResult.vue index 547feb25ac..78c9c31698 100644 --- a/frontend/src/business/components/api/definition/components/response/ResponseResult.vue +++ b/frontend/src/business/components/api/definition/components/response/ResponseResult.vue @@ -41,7 +41,7 @@
Body : -
{{response.body}}
+
{{response.body ? response.body:""}}