gleono commented on code in PR #92:
URL:
https://github.com/apache/openwhisk-runtime-dotnet/pull/92#discussion_r1796209273
##########
core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/HttpResponseExtension.cs:
##########
@@ -27,15 +27,14 @@ public static class HttpResponseExtension
{
public static async Task WriteResponse(this HttpResponse response, int
code, string content)
{
- byte[] bytes = Encoding.UTF8.GetBytes(content);
- response.ContentLength = bytes.Length;
+ response.ContentLength = Encoding.UTF8.GetByteCount(content);
response.StatusCode = code;
await response.WriteAsync(content);
}
public static async Task WriteError(this HttpResponse response, string
errorMessage)
{
- JObject message = new JObject {{"error", new
JValue(errorMessage)}};
+ JObject message = new() {{"error", new JValue(errorMessage)}};
Review Comment:
Shorter syntax for constructors. Type is already in the declaration of the
variable so, no need to be redundant.
--
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]