mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-03 04:28:51 +08:00
fix: 导入id和请求id一致
This commit is contained in:
parent
18d2d68486
commit
5d37c09413
@ -11,7 +11,6 @@ import io.metersphere.api.dto.parse.ApiImport;
|
||||
import io.metersphere.api.dto.scenario.Body;
|
||||
import io.metersphere.api.dto.scenario.KeyValue;
|
||||
import io.metersphere.api.dto.scenario.request.RequestType;
|
||||
import io.metersphere.commons.constants.MsRequestBodyType;
|
||||
import io.metersphere.commons.constants.SwaggerParameterType;
|
||||
import io.swagger.models.*;
|
||||
import io.swagger.models.parameters.*;
|
||||
@ -64,6 +63,7 @@ public class Swagger2Parser extends ApiImportAbstractParser {
|
||||
MsHTTPSamplerProxy request = buildRequest(operation, pathName, method.name());
|
||||
parseParameters(operation, request);
|
||||
apiDefinition.setRequest(JSON.toJSONString(request));
|
||||
apiDefinition.setId(request.getId());
|
||||
results.add(apiDefinition);
|
||||
|
||||
|
||||
|
@ -227,7 +227,6 @@ public class ApiDefinitionService {
|
||||
private ApiDefinition createTest(ApiDefinitionResult request, ApiDefinitionMapper batchMapper) {
|
||||
SaveApiDefinitionRequest saveReq = new SaveApiDefinitionRequest();
|
||||
BeanUtils.copyBean(saveReq, request);
|
||||
saveReq.setId(UUID.randomUUID().toString());
|
||||
checkNameExist(saveReq);
|
||||
final ApiDefinitionWithBLOBs test = new ApiDefinitionWithBLOBs();
|
||||
BeanUtils.copyBean(test, request);
|
||||
@ -340,7 +339,6 @@ public class ApiDefinitionService {
|
||||
item.setModuleId(importRequest.getModuleId());
|
||||
item.setModulePath(importRequest.getModulePath());
|
||||
item.setEnvironmentId(importRequest.getEnvironmentId());
|
||||
item.setId(UUID.randomUUID().toString());
|
||||
item.setUserId(null);
|
||||
createTest(item, batchMapper);
|
||||
if (i % 300 == 0) {
|
||||
|
@ -103,24 +103,20 @@
|
||||
modeChange(mode) {
|
||||
switch (this.body.type) {
|
||||
case "JSON":
|
||||
this.body.format = "json";
|
||||
this.setContentType("application/json");
|
||||
break;
|
||||
case "XML":
|
||||
this.body.format = "xml";
|
||||
this.setContentType("text/xml");
|
||||
break;
|
||||
case "WWW_FORM":
|
||||
this.body.format = "form";
|
||||
this.setContentType("application/x-www-form-urlencoded");
|
||||
break;
|
||||
// todo from data
|
||||
case "BINARY":
|
||||
this.body.format = "binary";
|
||||
this.setContentType("application/octet-stream");
|
||||
break;
|
||||
default:
|
||||
this.removeContentType();
|
||||
this.body.format = mode;
|
||||
break;
|
||||
}
|
||||
},
|
||||
@ -154,10 +150,7 @@
|
||||
|
||||
created() {
|
||||
if (!this.body.type) {
|
||||
this.body.type = BODY_TYPE.KV;
|
||||
}
|
||||
if (!this.body.format) {
|
||||
this.body.format = BODY_FORMAT.TEXT;
|
||||
this.body.type = BODY_TYPE.FORM_DATA;
|
||||
}
|
||||
this.body.kvs.forEach(param => {
|
||||
if (!param.type) {
|
||||
|
@ -736,7 +736,7 @@ export class Body extends BaseConfig {
|
||||
}
|
||||
|
||||
isKV() {
|
||||
return this.type === BODY_TYPE.KV;
|
||||
return [BODY_TYPE.FORM_DATA, BODY_TYPE.WWW_FORM, BODY_TYPE.BINARY].indexOf(this.type) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
return {
|
||||
editor: null,
|
||||
error: false,
|
||||
json: JSON.parse(this.value),
|
||||
json: JSON.parse(this.value ? this.value : "{}"),
|
||||
internalChange: false,
|
||||
expandedModes: ["tree", "view", "form"],
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user