diff --git a/src/LibKubernetesGenerator/templates/Operations.cs.template b/src/LibKubernetesGenerator/templates/Operations.cs.template index 2297b0d..94ad962 100644 --- a/src/LibKubernetesGenerator/templates/Operations.cs.template +++ b/src/LibKubernetesGenerator/templates/Operations.cs.template @@ -7,7 +7,7 @@ namespace k8s; public partial class AbstractKubernetes : I{{name}}Operations -{ +{ {{#apis}} /// async Task"}}> I{{name}}Operations.{{GetMethodName operation "WithHttpMessagesAsync"}}( @@ -17,7 +17,7 @@ public partial class AbstractKubernetes : I{{name}}Operations IReadOnlyDictionary> customHeaders, CancellationToken cancellationToken) { - var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); + using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); cts.CancelAfter(HttpClientTimeout); {{#IfParamContains operation "watch"}} if (watch == true) @@ -58,13 +58,13 @@ public partial class AbstractKubernetes : I{{name}}Operations {{#IfParamDoesNotContain operation "body"}} var httpResponse = await SendRequest(url, HttpMethods.{{Method}}, customHeaders, null, cancellationToken); {{/IfParamDoesNotContain operation "body"}} - // Create Result + // Create Result var httpRequest = httpResponse.RequestMessage; {{#IfReturnType operation "void"}} HttpOperationResponse result = new HttpOperationResponse() { Request = httpRequest, Response = httpResponse }; {{/IfReturnType operation "void"}} {{#IfReturnType operation "obj"}} - var result = await CreateResultAsync{{GetReturnType operation "<>"}}( + var result = await CreateResultAsync{{GetReturnType operation "<>"}}( httpRequest, httpResponse, {{#IfParamContains operation "watch"}}