gleono commented on code in PR #92:
URL: 
https://github.com/apache/openwhisk-runtime-dotnet/pull/92#discussion_r1796215000


##########
core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/Init.cs:
##########
@@ -54,58 +53,52 @@ public async Task<Run> HandleRequest(HttpContext 
httpContext)
                 {
                     await httpContext.Response.WriteError("Cannot initialize 
the action more than once.");
                     Console.Error.WriteLine("Cannot initialize the action more 
than once.");
-                    return (new Run(Type, Method, Constructor, 
AwaitableMethod));
+                    return new Run(_type, _method, _constructor, 
_awaitableMethod);
                 }
 
-                string body = await new 
StreamReader(httpContext.Request.Body).ReadToEndAsync();
+                using StreamReader reader = new(httpContext.Request.Body);
+                string body = await reader.ReadToEndAsync();
                 JObject inputObject = JObject.Parse(body);
-                if (!inputObject.ContainsKey("value"))
+                if (!inputObject.TryGetValue("value", out JToken? message) || 
message is not JObject valueObj)
                 {
                     await httpContext.Response.WriteError("Missing main/no 
code to execute.");
-                    return (null);
+                    return null;

Review Comment:
   I am not sure why all return values are between parentheses. Is this 
enforced by the Scalariform plugin?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to