In case if basePath equals to / we should not append it to url, behaviour was changed to fit this requirements (#4942)

This commit is contained in:
Egor Masalitin 2017-03-06 17:48:20 +02:00 committed by wing328
parent a710149cdd
commit 722b96bcec

View File

@ -75,12 +75,12 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
StringBuilder hostBuilder = new StringBuilder();
hostBuilder.append(getScheme());
hostBuilder.append("://");
if (swagger.getHost() != null) {
if (!StringUtils.isEmpty(swagger.getHost())) {
hostBuilder.append(swagger.getHost());
} else {
hostBuilder.append("localhost");
}
if (swagger.getBasePath() != null) {
if (!StringUtils.isEmpty(swagger.getBasePath()) && !swagger.getBasePath().equals("/")) {
hostBuilder.append(swagger.getBasePath());
}
return hostBuilder.toString();