mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-12 12:33:18 +00:00
Fix issue where findAll endpoints would NOT respond (404 result) when a trailing slash was used. Add a single IT which proves it responds the same regardless of trailing slash or not (previously this IT failed)
This commit is contained in:
@@ -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 apiCategory
|
||||||
* @param model
|
* @param model
|
||||||
@@ -969,7 +970,7 @@ public class RestResourceController implements InitializingBean {
|
|||||||
* @param assembler
|
* @param assembler
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.GET)
|
@RequestMapping(method = RequestMethod.GET, value = {"", "/"})
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends RestAddressableModel> PagedModel<DSpaceResource<T>> findAll(@PathVariable String apiCategory,
|
public <T extends RestAddressableModel> PagedModel<DSpaceResource<T>> findAll(@PathVariable String apiCategory,
|
||||||
@PathVariable String model, Pageable page, PagedResourcesAssembler assembler, HttpServletResponse response,
|
@PathVariable String model, Pageable page, PagedResourcesAssembler assembler, HttpServletResponse response,
|
||||||
|
@@ -51,5 +51,10 @@ public class ConfigurationRestRepositoryIT extends AbstractControllerIntegration
|
|||||||
public void getAll() throws Exception {
|
public void getAll() throws Exception {
|
||||||
getClient().perform(get("/api/config/properties/"))
|
getClient().perform(get("/api/config/properties/"))
|
||||||
.andExpect(status().isMethodNotAllowed());
|
.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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user