This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit c59ae6e999aac2f7a7c79e15d8477b9ba96ccfce
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Jun 4 11:51:51 2021 +0100

    Refactor HEAD testing so other Servlets can be tested
---
 test/javax/servlet/http/TestHttpServlet.java | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/test/javax/servlet/http/TestHttpServlet.java 
b/test/javax/servlet/http/TestHttpServlet.java
index 6a011c4..89e8521 100644
--- a/test/javax/servlet/http/TestHttpServlet.java
+++ b/test/javax/servlet/http/TestHttpServlet.java
@@ -117,20 +117,24 @@ public class TestHttpServlet extends TomcatBaseTest {
 
 
     @Test
-    public void testChunkingWithHead() throws Exception {
+    public void testHeadWithChunking() throws Exception {
+        doTestHead(new ChunkingServlet());
+    }
+
+
+    private void doTestHead(Servlet servlet) throws Exception {
         Tomcat tomcat = getTomcatInstance();
 
         // No file system docBase required
         StandardContext ctx = (StandardContext) tomcat.addContext("", null);
 
-        ChunkingServlet s = new ChunkingServlet();
-        Tomcat.addServlet(ctx, "ChunkingServlet", s);
-        ctx.addServletMappingDecoded("/chunking", "ChunkingServlet");
+        Tomcat.addServlet(ctx, "TestServlet", servlet);
+        ctx.addServletMappingDecoded("/test", "TestServlet");
 
         tomcat.start();
 
         Map<String,List<String>> getHeaders = new CaseInsensitiveKeyMap<>();
-        String path = "http://localhost:"; + getPort() + "/chunking";
+        String path = "http://localhost:"; + getPort() + "/test";
         ByteChunk out = new ByteChunk();
 
         int rc = getUrl(path, out, getHeaders);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to