mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-05 05:29:29 +08:00
fix: postman 导入body异常
This commit is contained in:
parent
df9eba580a
commit
ccf90308dd
@ -106,8 +106,13 @@ public class PostmanParser extends ApiImportAbstractParser {
|
||||
if (StringUtils.equals(bodyMode, PostmanRequestBodyMode.RAW.value())) {
|
||||
body.setRaw(postmanBody.getString(bodyMode));
|
||||
body.setType(MsRequestBodyType.RAW.value());
|
||||
String language = postmanBody.getJSONObject("options").getJSONObject(PostmanRequestBodyMode.RAW.value()).getString("language");
|
||||
body.setFormat(language);
|
||||
JSONObject options = postmanBody.getJSONObject("options");
|
||||
if (options != null) {
|
||||
JSONObject raw = options.getJSONObject(PostmanRequestBodyMode.RAW.value());
|
||||
if (raw != null) {
|
||||
body.setFormat(raw.getString("language"));
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equals(bodyMode, PostmanRequestBodyMode.FORM_DATA.value()) || StringUtils.equals(bodyMode, PostmanRequestBodyMode.URLENCODED.value())) {
|
||||
List<PostmanKeyValue> postmanKeyValues = JSON.parseArray(postmanBody.getString(bodyMode), PostmanKeyValue.class);
|
||||
body.setType(MsRequestBodyType.KV.value());
|
||||
|
Loading…
Reference in New Issue
Block a user