From 13070c62afe3135944260a80606f734357a1f017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cardoso?= Date: Mon, 30 Nov 2015 15:54:05 +0100 Subject: [PATCH] =htc #19159 Adds falback for wildcard charset with decimal priority For content types with no registered charset (e.g. image/gif), an Accept-Charset header with decimal priority (`Accept-Charset *;q=0.99`) should not reject the request. --- .../scaladsl/marshalling/ContentNegotiationSpec.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/akka-http-tests/src/test/scala/akka/http/scaladsl/marshalling/ContentNegotiationSpec.scala b/akka-http-tests/src/test/scala/akka/http/scaladsl/marshalling/ContentNegotiationSpec.scala index 649e45df5e..8fe3d5faad 100644 --- a/akka-http-tests/src/test/scala/akka/http/scaladsl/marshalling/ContentNegotiationSpec.scala +++ b/akka-http-tests/src/test/scala/akka/http/scaladsl/marshalling/ContentNegotiationSpec.scala @@ -96,6 +96,11 @@ class ContentNegotiationSpec extends FreeSpec with Matchers { accept(`text/plain` withCharset `UTF-16`) should reject } + "Accept-Charset: *;q=0.1" test { accept ⇒ + accept(`text/plain`) should select(`text/plain` withCharset `UTF-8`) + accept(`image/gif`) should select(`image/gif`) + } + "Accept-Charset: us;q=0.1,*;q=0" test { accept ⇒ accept(`text/plain`) should select(`text/plain` withCharset `US-ASCII`) accept(`text/plain` withCharset `UTF-8`) should reject @@ -171,4 +176,5 @@ class ContentNegotiationSpec extends FreeSpec with Matchers { testHeaders(headers: _*)(accept ⇒ body(accept)) } } -} \ No newline at end of file +} +