Fix log return disposed obj (#705)
* generator not to dispose stream * new generated code * test to cover log stream
This commit is contained in:
@@ -466,7 +466,7 @@ namespace k8s
|
||||
}
|
||||
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
|
||||
}
|
||||
{{/IfReturnType operation "stream"}}
|
||||
{{/IfReturnType operation "obj"}}
|
||||
}
|
||||
{{/IfReturnType operation "any"}}
|
||||
if (_shouldTrace)
|
||||
|
||||
@@ -64,6 +64,17 @@ namespace k8s
|
||||
{{/operation.parameters}}
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
{{#IfReturnType operation "stream"}}
|
||||
var _result = await operations.{{GetMethodName operation "WithHttpMessagesAsync"}}(
|
||||
{{#operation.parameters}}
|
||||
{{GetDotNetName .}},
|
||||
{{/operation.parameters}}
|
||||
null,
|
||||
cancellationToken);
|
||||
_result.Request.Dispose();
|
||||
{{GetReturnType operation "_result.Body"}};
|
||||
{{/IfReturnType operation "stream"}}
|
||||
{{#IfReturnType operation "obj"}}
|
||||
using (var _result = await operations.{{GetMethodName operation "WithHttpMessagesAsync"}}(
|
||||
{{#operation.parameters}}
|
||||
{{GetDotNetName .}},
|
||||
@@ -73,6 +84,17 @@ namespace k8s
|
||||
{
|
||||
{{GetReturnType operation "_result.Body"}};
|
||||
}
|
||||
{{/IfReturnType operation "obj"}}
|
||||
{{#IfReturnType operation "void"}}
|
||||
using (var _result = await operations.{{GetMethodName operation "WithHttpMessagesAsync"}}(
|
||||
{{#operation.parameters}}
|
||||
{{GetDotNetName .}},
|
||||
{{/operation.parameters}}
|
||||
null,
|
||||
cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
}
|
||||
{{/IfReturnType operation "void"}}
|
||||
}
|
||||
|
||||
{{/.}}
|
||||
|
||||
@@ -956,7 +956,7 @@ namespace KubernetesWatchGenerator
|
||||
{
|
||||
fn(null);
|
||||
}
|
||||
else if (type == "stream" && rt == "Stream")
|
||||
else if (type.ToLower() == rt.ToLower())
|
||||
{
|
||||
fn(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user