Skip to content

Commit f3a17ac

Browse files
authoredFeb 14, 2024··
Fix compression negotiation (#1898)
Fixes #1897 This fixes compression negotiation so that gzip will be used.
1 parent 855b65a commit f3a17ac

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed
 

‎runtime/src/main/scala/akka/grpc/internal/Codecs.scala

+2-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ object Codecs {
2525
* @return a codec to compress data frame bodies with, which will be [[Identity]] unless the client specifies support for another supported encoding.
2626
*/
2727
def negotiate(request: jm.HttpRequest): Codec = {
28-
val accepted: Array[String] =
29-
request.asInstanceOf[sm.HttpMessage].header[`Message-Accept-Encoding`] match {
30-
case Some(h) => h.values
31-
case None => Array.empty
32-
}
28+
// DO NOT USE request.header[`Message-Accept-Encoding`], as that doesn't work for custom headers
29+
val accepted = `Message-Accept-Encoding`.findIn(request.asInstanceOf[sm.HttpMessage].headers)
3330

3431
if (accepted.length == 0) {
3532
Identity

0 commit comments

Comments
 (0)
Please sign in to comment.