You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2022/12/05 02:55:02 UTC

[james-project] branch master updated: JAMES-3863 JMAP OPTIONS should support caching

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

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/master by this push:
     new 5102e7f3d8 JAMES-3863 JMAP OPTIONS should support caching
5102e7f3d8 is described below

commit 5102e7f3d864fa3fae73471395c2b30e4273210f
Author: Quan Tran <hq...@linagora.com>
AuthorDate: Mon Nov 28 16:14:23 2022 +0700

    JAMES-3863 JMAP OPTIONS should support caching
---
 .../src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java | 3 ++-
 .../james/jmap/draft/methods/integration/CorsHeaderAPITest.java     | 3 ++-
 .../jmap/draft/methods/integration/cucumber/DownloadStepdefs.java   | 1 +
 .../jmap/src/main/java/org/apache/james/jmap/JMAPRoutes.java        | 3 ++-
 .../jmap/src/test/java/org/apache/james/jmap/JMAPServerTest.java    | 6 ++++--
 5 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java
index c25e23bb18..587d46ceaa 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java
@@ -175,7 +175,8 @@ public abstract class JMAPAuthenticationTest {
         .then()
             .header("Access-Control-Allow-Origin", "*")
             .header("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT")
-            .header("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept");
+            .header("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept")
+            .header("Access-Control-Max-Age", "86400");
     }
 
     @Test
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/CorsHeaderAPITest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/CorsHeaderAPITest.java
index c942c6946e..fe57a8bc6c 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/CorsHeaderAPITest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/CorsHeaderAPITest.java
@@ -77,6 +77,7 @@ public abstract class CorsHeaderAPITest {
         .then()
             .header("Access-Control-Allow-Origin", "*")
             .header("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT")
-            .header("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept");
+            .header("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept")
+            .header("Access-Control-Max-Age", "86400");
     }
 }
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/cucumber/DownloadStepdefs.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/cucumber/DownloadStepdefs.java
index 5d0aead017..9315d0cd82 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/cucumber/DownloadStepdefs.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/cucumber/DownloadStepdefs.java
@@ -501,6 +501,7 @@ public class DownloadStepdefs {
         assertThat(response.getFirstHeader("Access-Control-Allow-Origin").getValue()).isEqualTo("*");
         assertThat(response.getFirstHeader("Access-Control-Allow-Methods").getValue()).isEqualTo("GET, POST, DELETE, PUT");
         assertThat(response.getFirstHeader("Access-Control-Allow-Headers").getValue()).isEqualTo("Content-Type, Authorization, Accept");
+        assertThat(response.getFirstHeader("Access-Control-Max-Age").getValue()).isEqualTo("86400");
     }
 
     @Then("^the Content-Type is \"([^\"]*)\"$")
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPRoutes.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPRoutes.java
index 8c910272a9..fe7e4a3386 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPRoutes.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPRoutes.java
@@ -40,7 +40,8 @@ public interface JMAPRoutes {
         return (req, res) -> action.handleRequest(req, res
             .header("Access-Control-Allow-Origin", "*")
             .header("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT")
-            .header("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept"));
+            .header("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept")
+            .header("Access-Control-Max-Age", "86400"));
     }
 
     static JMAPRoute.Action redirectTo(String location) {
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/JMAPServerTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/JMAPServerTest.java
index 84321a568a..f856a126cb 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/JMAPServerTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/JMAPServerTest.java
@@ -260,7 +260,8 @@ class JMAPServerTest {
                 .statusCode(200)
                 .header("Access-Control-Allow-Origin", "*")
                 .header("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT")
-                .header("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept");
+                .header("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept")
+                .header("Access-Control-Max-Age", "86400");
 
             when()
                 .options("/a")
@@ -268,7 +269,8 @@ class JMAPServerTest {
                 .statusCode(200)
                 .header("Access-Control-Allow-Origin", "*")
                 .header("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT")
-                .header("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept");
+                .header("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept")
+                .header("Access-Control-Max-Age", "86400");
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org