Merge branch 'v1.1' of github.com:fit2cloudrd/metersphere-server into v1.1

This commit is contained in:
Captain.B 2020-07-22 19:07:56 +08:00
commit 2e05128188
1 changed files with 2 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.metersphere.api.dto.ApiTestImportRequest; import io.metersphere.api.dto.ApiTestImportRequest;
import io.metersphere.api.dto.parse.ApiImport; import io.metersphere.api.dto.parse.ApiImport;
import io.metersphere.api.dto.scenario.request.RequestType;
import io.metersphere.commons.constants.MsRequestBodyType; import io.metersphere.commons.constants.MsRequestBodyType;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpMethod;
@ -38,6 +39,7 @@ public class MsParser extends ApiImportAbstractParser {
requestsObject.keySet().forEach(requestName -> { requestsObject.keySet().forEach(requestName -> {
JSONObject requestObject = requestsObject.getJSONObject(requestName); JSONObject requestObject = requestsObject.getJSONObject(requestName);
requestObject.put("name", requestName); requestObject.put("name", requestName);
requestObject.put("type", RequestType.HTTP);
JSONArray bodies = requestObject.getJSONArray("body"); JSONArray bodies = requestObject.getJSONArray("body");
if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), HttpMethod.POST.name()) && bodies != null) { if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), HttpMethod.POST.name()) && bodies != null) {
StringBuilder bodyStr = new StringBuilder(); StringBuilder bodyStr = new StringBuilder();