Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ private Map<String, Object> buildSupportFileBundle(List<Object> allOperations, L
bundle.put("basePathWithoutHost", basePathWithoutHost);
bundle.put("scheme", URLPathUtils.getScheme(url, config));
bundle.put("host", url.getHost());
if (url.getPort() != 80 && url.getPort() != 443 ) {
if (url.getPort() != 80 && url.getPort() != 443 && url.getPort() != -1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that does the trick but why was the port -1 to begin with? Some default value? Unfortunate conversion or something?
If there's no way to make it so it doesn't get the -1 value I suppose a comment explaining why -1 is a possible value and needs to be handled would help in the future.
Port 80 and 443 people can figure it out, -1, not so much I guess.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The getPort() function is a part of URL class. The function getPort() returns the port of a specified URL. The function returns the port number or -1 if the port is not set

Ref: https://www.geeksforgeeks.org/url-getport-method-in-java-with-examples/

bundle.put("port", url.getPort());
}
bundle.put("contextPath", contextPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class Configuration

def initialize
@scheme = 'http'
@host = 'petstore.swagger.io:-1'
@host = 'petstore.swagger.io'
@base_path = '/v2'
@server_index = 0
@server_operation_index = {}
Expand Down