You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by bo...@apache.org on 2026/08/05 17:30:59 UTC

(knox) 30/49: KNOX-3238: fix HSTSHandlerTest

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

bonampak pushed a commit to branch feature/jakarta-jetty-upgrade
in repository https://gitbox.apache.org/repos/asf/knox.git

commit 477af8e18a89eca63c237d4eee348ce037a2e876
Author: bonampak <bo...@apache.org>
AuthorDate: Sun Apr 26 19:56:40 2026 +0200

    KNOX-3238: fix HSTSHandlerTest
---
 .../test/java/org/apache/knox/gateway/filter/HSTSHandlerTest.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/filter/HSTSHandlerTest.java b/gateway-server/src/test/java/org/apache/knox/gateway/filter/HSTSHandlerTest.java
index 777883aef..f0761b6c7 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/filter/HSTSHandlerTest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/filter/HSTSHandlerTest.java
@@ -21,6 +21,8 @@ import org.eclipse.jetty.http.HttpFields;
 import org.eclipse.jetty.server.Response;
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+
 public class HSTSHandlerTest {
 
     @Test
@@ -29,13 +31,12 @@ public class HSTSHandlerTest {
         HttpFields.Mutable headers = HttpFields.build();
         EasyMock.expect(response.getHeaders()).andReturn(headers).anyTimes();
 
-        response.getHeaders().put("Strict-Transport-Security", "max-age=1000");
-        EasyMock.expectLastCall().once();
         EasyMock.replay(response);
 
         HSTSHandler hstsHandler = new HSTSHandler("max-age=1000");
         hstsHandler.handle(null, response, null);
 
         EasyMock.verify(response);
+        assertEquals("max-age=1000", headers.get("Strict-Transport-Security"));
     }
 }