You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2021/10/18 07:50:49 UTC

[GitHub] [james-project] chibenwa commented on a change in pull request #699: JAMES-3662 Accept CORS headers without the JMAP API restriction on "A…

chibenwa commented on a change in pull request #699:
URL: https://github.com/apache/james-project/pull/699#discussion_r730654124



##########
File path: server/protocols/jmap/src/test/java/org/apache/james/jmap/JMAPServerTest.java
##########
@@ -222,9 +229,50 @@ void serverShouldReturnBadRequestWhenVersionIsUnknown() {
         }
     }
 
-    private static class FakeJMAPRoutes implements JMAPRoutes {
-        private static final Logger LOGGER = LoggerFactory.getLogger(FakeJMAPRoutes.class);
+    @Nested
+    class CorsRouteVersioningTest {
+        JMAPServer server;
+
+        @BeforeEach
+        void setUp() {
+            VersionParser versionParser = new VersionParser(SUPPORTED_VERSIONS, JMAPConfiguration.DEFAULT);
+            server = new JMAPServer(TEST_CONFIGURATION, CORS_ROUTES, versionParser);
+            server.start();
+
+            RestAssured.requestSpecification = new RequestSpecBuilder()
+                .setContentType(ContentType.JSON)
+                .setAccept(ContentType.JSON)
+                .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(StandardCharsets.UTF_8)))
+                .setPort(server.getPort().getValue())
+                .build();
+        }
+
+        @AfterEach
+        void tearDown() {
+            server.stop();
+        }
 
+        @Test
+        void corsRoutesOfAllVersionsShouldBeExposed() {
+            when()
+                .options("/b")
+            .then()
+                .statusCode(200)
+                .header("Access-Control-Allow-Origin", "*")

Review comment:
       This is another issue: we should make the origin domain configurable...




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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