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 2020/10/20 02:54:17 UTC

[james-project] 05/06: JAMES-2891 CORS Options should be supported for JMAP session endpoint

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

commit 3f9397b21844276eb19adeb16752841a4a2a23fb
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Oct 19 08:49:48 2020 +0700

    JAMES-2891 CORS Options should be supported for JMAP session endpoint
---
 .../src/main/scala/org/apache/james/jmap/http/SessionRoutes.scala  | 2 +-
 .../test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala  | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/SessionRoutes.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/SessionRoutes.scala
index a15726d..c087ed9 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/SessionRoutes.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/SessionRoutes.scala
@@ -65,7 +65,7 @@ class SessionRoutes @Inject() (@Named(InjectionKeys.RFC_8621) val authenticator:
         .action(generateSession)
         .corsHeaders,
       JMAPRoute.builder()
-        .endpoint(new Endpoint(HttpMethod.OPTIONS, AUTHENTICATION))
+        .endpoint(new Endpoint(HttpMethod.OPTIONS, JMAP_SESSION))
         .action(CORS_CONTROL)
         .noCorsHeaders)
 
diff --git a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala
index 2db8d50..dc7895a 100644
--- a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala
+++ b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala
@@ -92,6 +92,13 @@ class SessionRoutesTest extends AnyFlatSpec with BeforeAndAfter with Matchers {
       .contentType(ContentType.JSON)
   }
 
+  "options" should "return OK status" in {
+    RestAssured.when()
+      .options
+    .`then`
+      .statusCode(HttpStatus.SC_OK)
+  }
+
   "get" should "return correct session" in {
     val sessionJson = RestAssured.`with`()
         .get


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