Merge remote-tracking branch 'origin/v1.4' into v1.4

This commit is contained in:
Captain.B 2020-10-30 15:59:15 +08:00
commit d4160967d7
3 changed files with 8 additions and 12 deletions

View File

@ -362,14 +362,6 @@
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<build>

View File

@ -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();

View File

@ -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) {