< prev index next >

test/jdk/java/net/httpclient/HeadersTest1.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -93,20 +93,30 @@
             List<String> v1 = hd.allValues("Non-Existent-Header");
             assertNotNull(v1);
             assertTrue(v1.isEmpty(), String.valueOf(v1));
             TestKit.assertUnmodifiableList(v1);
 
-            List<String> v2 = hd.allValues("X-Foo-Response");
+            // case insensitive
+            List<String> headernames = List.of("X-Foo-Response",
+                                               "x-foo-Response",
+                                               "x-fOo-REspoNse");
+            for (String headerName : headernames) {
+                List<String> v2 = hd.allValues(headerName);
             assertNotNull(v2);
             assertEquals(new HashSet<>(v2), Set.of("resp1", "resp2"));
             TestKit.assertUnmodifiableList(v2);
+            }
 
             Map<String, List<String>> map = hd.map();
             TestKit.assertUnmodifiableMap(map);
             for (List<String> values : map.values()) {
                 TestKit.assertUnmodifiableList(values);
             }
+
+            // toString
+            hd.toString().toLowerCase().contains("content-length");
+            hd.toString().toLowerCase().contains("x-foo-response");
         } finally {
             server.stop(0);
             e.shutdownNow();
         }
         System.out.println("OK");
< prev index next >