diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/RestResourceController.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/RestResourceController.java index 77ad5d6724..62a3430f47 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/RestResourceController.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/RestResourceController.java @@ -961,7 +961,8 @@ public class RestResourceController implements InitializingBean { } /** - * Find all + * Find all via a GET request to the root endpoint. This method will trigger in cases where the called endpoint + * either includes a trailing slash or not. * * @param apiCategory * @param model @@ -969,7 +970,7 @@ public class RestResourceController implements InitializingBean { * @param assembler * @return */ - @RequestMapping(method = RequestMethod.GET) + @RequestMapping(method = RequestMethod.GET, value = {"", "/"}) @SuppressWarnings("unchecked") public PagedModel> findAll(@PathVariable String apiCategory, @PathVariable String model, Pageable page, PagedResourcesAssembler assembler, HttpServletResponse response, diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/ConfigurationRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/ConfigurationRestRepositoryIT.java index 1eab1ef68e..45a98a2039 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/ConfigurationRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/ConfigurationRestRepositoryIT.java @@ -51,5 +51,10 @@ public class ConfigurationRestRepositoryIT extends AbstractControllerIntegration public void getAll() throws Exception { getClient().perform(get("/api/config/properties/")) .andExpect(status().isMethodNotAllowed()); + + // Sanity check - Verify same result with no trailing slash, as DSpace should not care whether this + // findAll endpoint ends in a slash or not. + getClient().perform(get("/api/config/properties")) + .andExpect(status().isMethodNotAllowed()); } }