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

lukaszlenart pushed a commit to branch fix/WW-5374-context
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 790c663ddd625c20dbbc35796e28a1c93562d4b4
Author: Lukasz Lenart <lukaszlen...@apache.org>
AuthorDate: Thu Jan 18 11:24:34 2024 +0100

    WW-5374 Adds additional test case to cover disabling prepending context
---
 .../org/apache/struts2/interceptor/CspInterceptorTest.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git 
a/core/src/test/java/org/apache/struts2/interceptor/CspInterceptorTest.java 
b/core/src/test/java/org/apache/struts2/interceptor/CspInterceptorTest.java
index 38ef25b82..0b03c6e54 100644
--- a/core/src/test/java/org/apache/struts2/interceptor/CspInterceptorTest.java
+++ b/core/src/test/java/org/apache/struts2/interceptor/CspInterceptorTest.java
@@ -160,6 +160,20 @@ public class CspInterceptorTest extends 
StrutsInternalTestCase {
         checkHeader("/app/report-uri", enforcingMode);
     }
 
+    public void testNoPrependContext() throws Exception {
+        boolean enforcingMode = true;
+        mai.setAction(new TestAction());
+        request.setContextPath("/app");
+
+        interceptor.setEnforcingMode(enforcingMode);
+        interceptor.setReportUri("/report-uri");
+        interceptor.setPrependServletContext(false);
+
+        interceptor.intercept(mai);
+
+        checkHeader("/report-uri", enforcingMode);
+    }
+
     public void checkHeader(String reportUri, boolean enforcingMode) {
         String expectedCspHeader;
         if (Strings.isEmpty(reportUri)) {

Reply via email to