Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(graphql) this fixes the preflight OPTIONS call that was throwing … (
#30299) This pull request fixes the OPTIONS method that is called in pre-flight request and was failing with a 400 It also includes several changes to the `DotGraphQLHttpServlet` class and its corresponding test class to improve CORS header handling and update the usage of the `vavr` library. The most important changes include replacing `Function0` with `Lazy` for CORS headers, updating method calls to use `get()` instead of `apply()`, and modifying the configuration retrieval logic. ### Improvements to CORS header handling: * [`dotCMS/src/main/java/com/dotcms/graphql/DotGraphQLHttpServlet.java`](diffhunk://#diff-2cf65c77c46e085836ba6fe1ec0fb24afc2226d1e854e68fed23319d2e7306f2L9-R10): Replaced the `Function0` type with `Lazy` for the `corsHeaders` field to improve lazy initialization and readability. [[1]](diffhunk://#diff-2cf65c77c46e085836ba6fe1ec0fb24afc2226d1e854e68fed23319d2e7306f2L9-R10) [[2]](diffhunk://#diff-2cf65c77c46e085836ba6fe1ec0fb24afc2226d1e854e68fed23319d2e7306f2L67-R94) * [`dotCMS/src/main/java/com/dotcms/graphql/DotGraphQLHttpServlet.java`](diffhunk://#diff-2cf65c77c46e085836ba6fe1ec0fb24afc2226d1e854e68fed23319d2e7306f2L42-R44): Updated the `handleRequest` and `doOptions` methods to use `corsHeaders.get()` instead of `corsHeaders.apply()`. [[1]](diffhunk://#diff-2cf65c77c46e085836ba6fe1ec0fb24afc2226d1e854e68fed23319d2e7306f2L42-R44) [[2]](diffhunk://#diff-2cf65c77c46e085836ba6fe1ec0fb24afc2226d1e854e68fed23319d2e7306f2L51-R53) ### Configuration retrieval logic: * [`dotCMS/src/main/java/com/dotcms/graphql/DotGraphQLHttpServlet.java`](diffhunk://#diff-2cf65c77c46e085836ba6fe1ec0fb24afc2226d1e854e68fed23319d2e7306f2L67-R94): Modified the configuration retrieval logic to use `Config.subsetContainsAsList` and filter keys starting with specific prefixes for better clarity and efficiency. ### Test updates: * [`dotcms-integration/src/test/java/com/dotcms/graphql/DotGraphQLHttpServletTest.java`](diffhunk://#diff-fd7d80a1699d72b55de4c755c51f3a67c186e7855dc00ea2c383f0d6a38fee2fL27-R27): Updated the test method `testing_cors_headers` to use `corsHeaders.get()` instead of `corsHeaders.apply()`.
- Loading branch information