http-client-branch: additional test coverage for ofFileDownload http-client-branch
authorchegar
Sun, 11 Mar 2018 13:50:18 +0000
branchhttp-client-branch
changeset 56275 19e3bbc3e471
parent 56274 56e6b3f2e09f
child 56278 8bc5fb608e30
child 56292 b96b5cbb018d
http-client-branch: additional test coverage for ofFileDownload
test/jdk/java/net/httpclient/AsFileDownloadTest.java
--- 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);