test/jdk/java/net/httpclient/HeadersTest.java
branchhttp-client-branch
changeset 56365 7b2e4c363335
parent 56342 5c2ea761455b
child 56451 9585061fdb04
--- a/test/jdk/java/net/httpclient/HeadersTest.java	Mon Mar 26 19:54:18 2018 +0100
+++ b/test/jdk/java/net/httpclient/HeadersTest.java	Thu Mar 29 09:55:50 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -324,6 +324,15 @@
         }
     }
 
+    static void goodValue(String value) {
+        HttpRequest.Builder builder = HttpRequest.newBuilder(TEST_URI);
+        try {
+            builder.header("x-good", value);
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException("Unexpected IAE for x-good: " + value);
+        }
+    }
+
     static void badURI() throws Exception {
         HttpRequest.Builder builder = HttpRequest.newBuilder();
         URI uri = URI.create(TEST_URI.toString().replace("http", "ftp"));
@@ -538,6 +547,9 @@
         good("Hello#world");
         good("Qwer#ert");
         badValue("blah\r\n blah");
+        goodValue("blah blah");
+        goodValue("blah  blah");
+        goodValue("\"blah\\\"  \\\"blah\"");
         nullName();
         nullValue();
         nullHeaders();