fix: idea导入默认展示raw
This commit is contained in:
parent
868b062fa1
commit
a84535833d
|
@ -172,7 +172,7 @@ public abstract class ApiImportAbstractParser<T> implements ApiImportParser<T> {
|
|||
MsHTTPSamplerProxy request = buildRequest(name, path, method);
|
||||
if (StringUtils.isNotBlank(jsonSchema)) {
|
||||
request.getBody().setJsonSchema(JSONObject.parseObject(jsonSchema));
|
||||
request.getBody().setFormat("JSON-SCHEMA");
|
||||
request.getBody().setFormat("Raw");
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -30,7 +31,7 @@ public abstract class PostmanAbstractParserParser<T> extends ApiImportAbstractPa
|
|||
}
|
||||
requestDesc.getAuth(); // todo 认证方式等待优化
|
||||
PostmanUrl url = requestDesc.getUrl();
|
||||
MsHTTPSamplerProxy request = buildRequest(requestItem.getName(), url == null ? "" : url.getRaw(), requestDesc.getMethod(), requestDesc.getBody().getString("jsonSchema"));
|
||||
MsHTTPSamplerProxy request = buildRequest(requestItem.getName(), url == null ? "" : url.getRaw(), requestDesc.getMethod(), Optional.ofNullable(requestDesc.getBody()).orElse(new JSONObject()).getString("jsonSchema"));
|
||||
request.setRest(parseKeyValue(requestDesc.getUrl().getVariable()));
|
||||
if (StringUtils.isNotBlank(request.getPath())) {
|
||||
String path = request.getPath().split("\\?")[0];
|
||||
|
|
|
@ -139,7 +139,7 @@ export default {
|
|||
this.reloadCodeEdit();
|
||||
},
|
||||
'body.raw'() {
|
||||
if (this.body.format !== 'JSON-SCHEMA' && this.body.raw) {
|
||||
if (this.body.format !== 'JSON-SCHEMA' && this.body.raw && !this.body.jsonSchema) {
|
||||
try {
|
||||
const MsConvert = new Convert();
|
||||
let data = MsConvert.format(JSON.parse(this.body.raw));
|
||||
|
|
Loading…
Reference in New Issue