Skip to content

Commit

Permalink
Ignore null headers and allow full url paths (#6760)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianghaolu authored Dec 12, 2019
1 parent b90bab4 commit 0937d8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private HttpRequest createHttpRequest(SwaggerMethodParser methodParser, Object[]
// segment in the host.
if (path != null && !path.isEmpty() && !path.equals("/")) {
String hostPath = urlBuilder.getPath();
if (hostPath == null || hostPath.isEmpty() || hostPath.equals("/")) {
if (hostPath == null || hostPath.isEmpty() || hostPath.equals("/") || path.contains("://")) {
urlBuilder.setPath(path);
} else {
urlBuilder.setPath(hostPath + "/" + path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,16 @@ public Iterable<HttpHeader> setHeaders(Object[] swaggerMethodArguments) {
for (final Map.Entry<String, ?> headerCollectionEntry : headerCollection.entrySet()) {
final String headerName = headerCollectionPrefix + headerCollectionEntry.getKey();
final String headerValue = serialize(headerCollectionEntry.getValue());
result.put(headerName, headerValue);
if (headerValue != null) {
result.put(headerName, headerValue);
}
}
} else {
final String headerName = headerSubstitution.getUrlParameterName();
final String headerValue = serialize(methodArgument);
result.put(headerName, headerValue);
if (headerValue != null) {
result.put(headerName, headerValue);
}
}
}
}
Expand Down

0 comments on commit 0937d8e

Please sign in to comment.