Skip to content

Commit c23baaf

Browse files
Fixed bug in methods which hit "apis/{group}/..." url (#741)
* Moved _url.Replace("/apis//", "/api/") down several lines. Consider the following code: var _baseUrl = BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apis/{group}/{version}/namespaces/{namespace}/{plural}").ToString(); _url = _url.Replace("/apis//", "/api/"); _url = _url.Replace("{group}", group); _url = _url.Replace("{version}", version); _url = _url.Replace("{namespace}", namespaceParameter); _url = _url.Replace("{plural}", plural); If group is empty string, we need to replace /apis// with /api. To do this, we need to replace /apis// after {group}. Code after the change: var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apis/{group}/{version}/namespaces/{namespace}/{plural}").ToString(); _url = _url.Replace("{group}", group); _url = _url.Replace("{version}", version); _url = _url.Replace("{namespace}", namespaceParameter); _url = _url.Replace("{plural}", plural); _url = _url.Replace("/apis//", "/api/"); * Auto-generated changes
1 parent 7a02486 commit c23baaf

File tree

2 files changed

+553
-553
lines changed

2 files changed

+553
-553
lines changed

gen/KubernetesGenerator/templates/Kubernetes.cs.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ namespace k8s
6161
// Construct URL
6262
var _baseUrl = BaseUri.AbsoluteUri;
6363
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{{path}}").ToString();
64-
_url = _url.Replace("/apis//", "/api/");
6564
{{#operation.parameters}}
6665
{{#IfKindIs . "path"}}
6766
_url = _url.Replace("{{AddCurly name}}", {{GetDotNetName name}});
6867
{{/IfKindIs . "path"}}
6968
{{/operation.parameters}}
69+
_url = _url.Replace("/apis//", "/api/");
7070
List<string> _queryParameters = new List<string>();
7171
{{#operation.parameters}}
7272
{{#IfKindIs . "query"}}

0 commit comments

Comments
 (0)