From b7ce2f80254f767107825e941b472144b6f6bfa5 Mon Sep 17 00:00:00 2001 From: q4speed Date: Fri, 30 Oct 2020 13:50:49 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20pom=E5=8E=BB=E6=8E=89=E9=87=8D=E5=A4=8D=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/pom.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/backend/pom.xml b/backend/pom.xml index b20370f229..5df379de4c 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -362,14 +362,6 @@ httpclient 4.5.6 - - - org.apache.commons - commons-text - 1.3 - - - From 5cf701849038295c5fdffc6dec1a5da90bd8c50f Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 30 Oct 2020 14:07:47 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E6=8F=92=E4=BB=B6=E5=BD=95=E5=88=B6=E5=AF=BC=E5=85=A5put?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/io/metersphere/api/parse/MsParser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/parse/MsParser.java b/backend/src/main/java/io/metersphere/api/parse/MsParser.java index 20de9653d3..dd33f8709c 100644 --- a/backend/src/main/java/io/metersphere/api/parse/MsParser.java +++ b/backend/src/main/java/io/metersphere/api/parse/MsParser.java @@ -61,7 +61,7 @@ public class MsParser extends ApiImportAbstractParser { Object body = requestObject.get("body"); if (body instanceof JSONArray) { JSONArray bodies = requestObject.getJSONArray("body"); - if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), "POST") && bodies != null) { + if (bodies != null) { StringBuilder bodyStr = new StringBuilder(); for (int i = 0; i < bodies.size(); i++) { String tmp = bodies.getString(i); @@ -74,7 +74,7 @@ public class MsParser extends ApiImportAbstractParser { } } else if (body instanceof JSONObject) { JSONObject bodyObj = requestObject.getJSONObject("body"); - if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), "POST") && bodyObj != null) { + if (bodyObj != null) { JSONArray kvs = new JSONArray(); bodyObj.keySet().forEach(key -> { JSONObject kv = new JSONObject(); From d1fc4b4cdd6c9ee5261b2eff5797d15f53ef0240 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 30 Oct 2020 14:37:00 +0800 Subject: [PATCH 3/3] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B?= =?UTF-8?q?=E8=AF=95):=20=E8=AF=B7=E6=B1=82=E4=BD=93=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E7=9A=84=E8=AF=B7=E6=B1=82=E6=A0=BC=E5=BC=8F=E4=BB=A5=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E5=A4=B4=E5=A1=AB=E5=86=99=E4=BC=98=E5=85=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/components/api/test/model/ScenarioModel.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/business/components/api/test/model/ScenarioModel.js b/frontend/src/business/components/api/test/model/ScenarioModel.js index c123e7cf03..60c738a149 100644 --- a/frontend/src/business/components/api/test/model/ScenarioModel.js +++ b/frontend/src/business/components/api/test/model/ScenarioModel.js @@ -1363,15 +1363,19 @@ class JMXGenerator { } addContentType(request, type) { + let hasContentType = false; for (let index in request.headers) { if (request.headers.hasOwnProperty(index)) { - if (request.headers[index].name === 'Content-Type') { + if (request.headers[index].name === 'Content-Type' && request.headers[index].enable != false) { request.headers.splice(index, 1); + hasContentType = true; break; } } } - request.headers.push(new KeyValue({name: 'Content-Type', value: type})); + if (!hasContentType) { + request.headers.push(new KeyValue({name: 'Content-Type', value: type})); + } } addRequestArguments(httpSamplerProxy, request) {