[Ruby] fix port in the Ruby client (#7464)

* fix port in ruby client

* use serverPort instead

* update samples, skip if port is 80
This commit is contained in:
William Cheng 2020-09-21 13:23:45 +08:00 committed by GitHub
parent a29d9a9ff4
commit 985c4b36a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -775,6 +775,9 @@ public class DefaultGenerator implements Generator {
bundle.put("basePathWithoutHost", basePathWithoutHost); bundle.put("basePathWithoutHost", basePathWithoutHost);
bundle.put("scheme", URLPathUtils.getScheme(url, config)); bundle.put("scheme", URLPathUtils.getScheme(url, config));
bundle.put("host", url.getHost()); bundle.put("host", url.getHost());
if (url.getPort() != 80 ) {
bundle.put("port", url.getPort());
}
bundle.put("contextPath", contextPath); bundle.put("contextPath", contextPath);
bundle.put("apiInfo", apis); bundle.put("apiInfo", apis);
bundle.put("models", allModels); bundle.put("models", allModels);

View File

@ -90,7 +90,7 @@ module {{moduleName}}
def initialize def initialize
@scheme = '{{scheme}}' @scheme = '{{scheme}}'
@host = '{{host}}' @host = '{{host}}{{#port}}:{{{.}}}{{/port}}'
@base_path = '{{contextPath}}' @base_path = '{{contextPath}}'
@api_key = {} @api_key = {}
@api_key_prefix = {} @api_key_prefix = {}