test/jdk/java/net/httpclient/AsFileDownloadTest.java
branchhttp-client-branch
changeset 56275 19e3bbc3e471
parent 56265 ec34ae013fbe
child 56451 9585061fdb04
--- a/test/jdk/java/net/httpclient/AsFileDownloadTest.java	Sat Mar 10 10:11:43 2018 +0000
+++ b/test/jdk/java/net/httpclient/AsFileDownloadTest.java	Sun Mar 11 13:50:18 2018 +0000
@@ -208,6 +208,9 @@
             { "111", "attachment; filename=\"bad;"         },  // badly quoted with ';'
             { "112", "attachment; filename=\"bad ;"        },  // badly quoted with ' ;'
             { "113", "attachment; filename*=utf-8''xx.txt "},  // no "filename" param
+
+            { "120", "<<NOT_PRESENT>>"                     },  // header not present
+
     };
 
     @DataProvider(name = "negative")
@@ -343,8 +346,9 @@
                  OutputStream os = t.getResponseBody()) {
                 byte[] bytes = is.readAllBytes();
 
-                t.getResponseHeaders().set("Content-Disposition",
-                        contentDispositionValueFromURI(t.getRequestURI()));
+                String value = contentDispositionValueFromURI(t.getRequestURI());
+                if (!value.equals("<<NOT_PRESENT>>"))
+                    t.getResponseHeaders().set("Content-Disposition", value);
 
                 t.sendResponseHeaders(200, bytes.length);
                 os.write(bytes);
@@ -359,8 +363,9 @@
                  OutputStream os = t.getResponseBody()) {
                 byte[] bytes = is.readAllBytes();
 
-                t.getResponseHeaders().addHeader("Content-Disposition",
-                        contentDispositionValueFromURI(t.getRequestURI()));
+                String value = contentDispositionValueFromURI(t.getRequestURI());
+                if (!value.equals("<<NOT_PRESENT>>"))
+                    t.getResponseHeaders().addHeader("Content-Disposition", value);
 
                 t.sendResponseHeaders(200, bytes.length);
                 os.write(bytes);