This is an automated email from the ASF dual-hosted git repository.

pjfanning pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-grpc.git


The following commit(s) were added to refs/heads/main by this push:
     new f5f08e0d add gzip header regression tests (#839)
f5f08e0d is described below

commit f5f08e0d50adacb5e5701f7879c6f2c0c78c1b7e
Author: PJ Fanning <[email protected]>
AuthorDate: Mon Aug 17 10:28:48 2026 +0100

    add gzip header regression tests (#839)
---
 .../scala/org/apache/pekko/grpc/CodecsSpec.scala     | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/runtime/src/test/scala/org/apache/pekko/grpc/CodecsSpec.scala 
b/runtime/src/test/scala/org/apache/pekko/grpc/CodecsSpec.scala
index c5755913..33753ce9 100644
--- a/runtime/src/test/scala/org/apache/pekko/grpc/CodecsSpec.scala
+++ b/runtime/src/test/scala/org/apache/pekko/grpc/CodecsSpec.scala
@@ -16,6 +16,7 @@ import org.apache.pekko
 import pekko.grpc.internal.{ Codecs, Gzip, Identity }
 import pekko.grpc.scaladsl.headers
 import pekko.http.scaladsl.model.HttpRequest
+import pekko.http.scaladsl.model.headers.RawHeader
 import io.grpc.Status
 import org.scalatest.matchers.should.Matchers
 import org.scalatest.wordspec.AnyWordSpec
@@ -58,6 +59,19 @@ class CodecsSpec extends AnyWordSpec with Matchers with 
TryValues {
       Codecs.negotiate(accept("xxxxx")) should be(Identity)
     }
 
+    // Regression test: akka-grpc #1897 — request.header[T] silently returns 
None for
+    // ModeledCustomHeader types, which would break compression negotiation.
+    // Our implementation uses findIn on raw headers instead, which works 
correctly.
+    "negotiate gzip from raw headers (not typed custom headers)" in {
+      val request = HttpRequest(headers = 
immutable.Seq(RawHeader("grpc-accept-encoding", "gzip")))
+      Codecs.negotiate(request) should be(Gzip)
+    }
+
+    "negotiate from raw headers with multiple encodings" in {
+      val request = HttpRequest(headers = 
immutable.Seq(RawHeader("grpc-accept-encoding", "gzip,identity")))
+      Codecs.negotiate(request) should be(Gzip)
+    }
+
   }
 
   "Detecting message encoding from remote" should {
@@ -80,6 +94,12 @@ class CodecsSpec extends AnyWordSpec with Matchers with 
TryValues {
       
detected.failure.exception.asInstanceOf[GrpcServiceException].status.getCode 
should be(
         Status.UNIMPLEMENTED.getCode)
     }
+
+    // Regression test: same as akka-grpc #1897 but for detect path
+    "detect encoding from raw headers (not typed custom headers)" in {
+      val request = HttpRequest(headers = 
immutable.Seq(RawHeader("grpc-encoding", "gzip")))
+      Codecs.detect(request).success.value should be(Gzip)
+    }
   }
 
 }


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

Reply via email to