From 8d389f02981552db4496e4becff1e2c3144aaddf Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 24 Jul 2020 18:22:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20post=20=E5=8F=82=E6=95=B0encoding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/metersphere/api/service/APIReportService.java | 7 ++++++- .../io/metersphere/commons/constants/APITestStatus.java | 2 +- .../business/components/api/test/model/ScenarioModel.js | 5 ++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/APIReportService.java b/backend/src/main/java/io/metersphere/api/service/APIReportService.java index f6947e8b38..beba5891e5 100644 --- a/backend/src/main/java/io/metersphere/api/service/APIReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/APIReportService.java @@ -87,7 +87,12 @@ public class APIReportService { // report report.setUpdateTime(System.currentTimeMillis()); - report.setStatus(APITestStatus.Completed.name()); + if (result.getError() > 0) { + report.setStatus(APITestStatus.Error.name()); + } else { + report.setStatus(APITestStatus.Success.name()); + } + apiTestReportMapper.updateByPrimaryKeySelective(report); } diff --git a/backend/src/main/java/io/metersphere/commons/constants/APITestStatus.java b/backend/src/main/java/io/metersphere/commons/constants/APITestStatus.java index 49cf4b88df..e15e03481b 100644 --- a/backend/src/main/java/io/metersphere/commons/constants/APITestStatus.java +++ b/backend/src/main/java/io/metersphere/commons/constants/APITestStatus.java @@ -1,5 +1,5 @@ package io.metersphere.commons.constants; public enum APITestStatus { - Saved, Starting, Running, Reporting, Completed, Error + Saved, Starting, Running, Reporting, Completed, Error, Success } diff --git a/frontend/src/business/components/api/test/model/ScenarioModel.js b/frontend/src/business/components/api/test/model/ScenarioModel.js index 3c3e59e9d5..904318e101 100644 --- a/frontend/src/business/components/api/test/model/ScenarioModel.js +++ b/frontend/src/business/components/api/test/model/ScenarioModel.js @@ -646,10 +646,9 @@ class JMXHttpRequest { } let url = new URL(request.url); this.hostname = decodeURIComponent(url.hostname); - this.pathname = decodeURIComponent(url.pathname); this.port = url.port; this.protocol = url.protocol.split(":")[0]; - this.pathname = this.getPostQueryParameters(request, this.pathname); + this.pathname = this.getPostQueryParameters(request, decodeURIComponent(url.pathname)); } else { if (environment) { this.port = environment.port; @@ -666,7 +665,7 @@ class JMXHttpRequest { path += '?'; request.parameters.forEach(parameter => { if (parameter.name) { - path += (parameter.name + '=' + parameter.value + '&'); + path += ((parameter.name) + '=' + (parameter.value) + '&'); } }); }