pjfanning commented on code in PR #822:
URL: https://github.com/apache/pekko-grpc/pull/822#discussion_r3741519787


##########
runtime/src/main/scala/org/apache/pekko/grpc/internal/GrpcProtocolWeb.scala:
##########
@@ -80,7 +81,41 @@ abstract class GrpcProtocolWebBase(subType: String) extends 
AbstractGrpcProtocol
     builder.result()
   }
 
-  private final def decodeTrailer(data: ByteString): List[HttpHeader] = ???
+  private final def decodeTrailer(data: ByteString): List[HttpHeader] = {
+    val str = data.utf8String
+    val len = str.length
+    val headers = List.newBuilder[HttpHeader]
+    var i = 0
+    while (i < len) {
+      // skip leading whitespace and blank lines
+      while (i < len &&
+        (str.charAt(i) == ' ' || str.charAt(i) == '\t' || str.charAt(i) == 
'\r' || str.charAt(i) == '\n'))
+        i += 1
+      if (i >= len) return headers.result()

Review Comment:
   @Philippus I refactored the code to remove the return



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to