diff --git a/play-ahc-ws-standalone/src/test/scala/play/api/libs/ws/ahc/AhcWSResponseSpec.scala b/play-ahc-ws-standalone/src/test/scala/play/api/libs/ws/ahc/AhcWSResponseSpec.scala index eeebc303..d44f16b1 100644 --- a/play-ahc-ws-standalone/src/test/scala/play/api/libs/ws/ahc/AhcWSResponseSpec.scala +++ b/play-ahc-ws-standalone/src/test/scala/play/api/libs/ws/ahc/AhcWSResponseSpec.scala @@ -128,6 +128,14 @@ class AhcWSResponseSpec extends Specification with DefaultBodyReadables with Def headers.contains("Bar") must beTrue } + "get headers map which retrieves headers case insensitively (for streamed responses)" in { + val srcHeaders = Map("Foo" -> Seq("a"), "foo" -> Seq("b"), "FOO" -> Seq("b"), "Bar" -> Seq("baz")) + val response = new StreamedResponse(null, 200, "", null, srcHeaders, null, true) + val headers = response.headers + headers("foo") must_== Seq("a", "b", "b") + headers("BAR") must_== Seq("baz") + } + "get a single header" in { val ahcResponse: AHCResponse = mock[AHCResponse] val ahcHeaders = new DefaultHttpHeaders(true) diff --git a/play-ahc-ws-standalone/src/test/scala/play/libs/ws/ahc/AhcWSResponseSpec.scala b/play-ahc-ws-standalone/src/test/scala/play/libs/ws/ahc/AhcWSResponseSpec.scala index 9a08b435..f0823d05 100644 --- a/play-ahc-ws-standalone/src/test/scala/play/libs/ws/ahc/AhcWSResponseSpec.scala +++ b/play-ahc-ws-standalone/src/test/scala/play/libs/ws/ahc/AhcWSResponseSpec.scala @@ -46,6 +46,14 @@ class AhcWSResponseSpec extends Specification with DefaultBodyReadables with Def headers.get("BAR").asScala must_== Seq("baz") } + "get headers map which retrieves headers case insensitively (for streamed responses)" in { + val srcHeaders = Map("Foo" -> Seq("a"), "foo" -> Seq("b"), "FOO" -> Seq("b"), "Bar" -> Seq("baz")) + val response = new StreamedResponse(null, 200, "", null, srcHeaders, null, true) + val headers = response.getHeaders + headers.get("foo").asScala must_== Seq("a", "b", "b") + headers.get("BAR").asScala must_== Seq("baz") + } + "get a single header" in { val srcResponse = mock[Response] val srcHeaders = new DefaultHttpHeaders()