fix github #84 .
This commit is contained in:
parent
592f692765
commit
d507fdd946
|
@ -25,6 +25,7 @@ package com.power.doc.builder;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.power.common.util.CollectionUtil;
|
||||
import com.power.common.util.FileUtil;
|
||||
import com.power.common.util.StringUtil;
|
||||
import com.power.doc.constants.DocGlobalConstants;
|
||||
|
@ -135,14 +136,22 @@ public class PostmanJsonBuilder {
|
|||
try {
|
||||
URL url1 = new java.net.URL(apiMethodDoc.getServerUrl());
|
||||
urlBean.setPort(String.valueOf(url1.getPort()));
|
||||
|
||||
List<String> hosts = new ArrayList<>();
|
||||
hosts.add(url1.getHost());
|
||||
urlBean.setHost(hosts);
|
||||
|
||||
List<String> paths = new ArrayList<>();
|
||||
paths.add(url1.getPath());
|
||||
urlBean.setPath(paths);
|
||||
} catch (MalformedURLException e) {
|
||||
}
|
||||
String shortUrl = PathUtil.toPostmanPath(apiMethodDoc.getPath());
|
||||
String[] paths = shortUrl.split("/");
|
||||
List<String> pathList = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(urlBean.getPath()) && shortUrl.indexOf(urlBean.getPath().get(0)) < 0) {
|
||||
pathList.add(urlBean.getPath().get(0).replaceAll("/", ""));
|
||||
}
|
||||
for (String str : paths) {
|
||||
if (StringUtil.isNotEmpty(str)) {
|
||||
pathList.add(str);
|
||||
|
|
|
@ -30,7 +30,9 @@ import java.util.List;
|
|||
* @author yu 2020/11/28.
|
||||
*/
|
||||
public class UrlBean {
|
||||
|
||||
private String raw;
|
||||
|
||||
private List<String> path;
|
||||
|
||||
private List<String> host;
|
||||
|
|
Loading…
Reference in New Issue