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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 843af91f61 Add tests for OPTIONS behaviour
843af91f61 is described below

commit 843af91f613dcfe6e3ccaffecf709485b84d3b6e
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Oct 23 19:56:45 2026 +0100

    Add tests for OPTIONS behaviour
    
    Co-authored by: Claude / Sonnet 5.5
---
 test/javax/servlet/http/TestHttpServlet.java | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/test/javax/servlet/http/TestHttpServlet.java 
b/test/javax/servlet/http/TestHttpServlet.java
index 66b1797cc1..2955255a8b 100644
--- a/test/javax/servlet/http/TestHttpServlet.java
+++ b/test/javax/servlet/http/TestHttpServlet.java
@@ -237,6 +237,15 @@ public class TestHttpServlet extends TomcatBaseTest {
     }
 
 
+    /*
+     * An Allow header set by the application before the default doPut() 
implementation is called must not be replaced.
+     */
+    @Test
+    public void testMethodNotAllowedExistingAllow() throws Exception {
+        doTestMethodNotAllowed(new AllowServlet(), "FOO");
+    }
+
+
     private void doTestDoOptions(Servlet servlet, String expectedAllow) throws 
Exception {
         Tomcat tomcat = getTomcatInstance();
 
@@ -629,4 +638,16 @@ public class TestHttpServlet extends TomcatBaseTest {
             doGet(req, resp);
         }
     }
+
+
+    private static class AllowServlet extends HttpServlet {
+
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        protected void doPut(HttpServletRequest req, HttpServletResponse resp) 
throws ServletException, IOException {
+            resp.setHeader("Allow", "FOO");
+            super.doPut(req, resp);
+        }
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to