Don't user root path for HAL endpoints
Update LinksMvcEndpoint and HalBrowserMvcEndpoint so that no longer try to use the `/` context path. Links are now available from `/links` and the HAL browser is available from `/hal`. The actuator HAL browser now works with either WebJars or the Spring Data version. It also now transforms the initial HTML so that the form is pre-populated with `/links`. When using Spring Data's HAL browser, the root includes a link to `/links` with a rel of `actuator`. See gh-3621
This commit is contained in:
@@ -59,10 +59,10 @@ public class SampleHypermediaJpaApplicationCustomLinksPathIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void links() throws Exception {
|
||||
this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON))
|
||||
this.mockMvc.perform(get("/links").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk()).andExpect(jsonPath("$._links").exists())
|
||||
.andExpect(jsonPath("$._links.health").exists())
|
||||
.andExpect(jsonPath("$._links.books").exists());
|
||||
.andExpect(jsonPath("$._links.books").doesNotExist());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -61,8 +61,7 @@ public class SampleHypermediaJpaApplicationSharedRootIntegrationTests {
|
||||
public void home() throws Exception {
|
||||
this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk()).andExpect(jsonPath("$._links").exists())
|
||||
.andExpect(jsonPath("$._links.health").exists())
|
||||
.andExpect(jsonPath("$._links.admin").exists())
|
||||
.andExpect(jsonPath("$._links.actuator").exists())
|
||||
.andExpect(jsonPath("$._links.books").exists());
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class SampleHypermediaJpaApplicationVanillaIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void adminLinks() throws Exception {
|
||||
this.mockMvc.perform(get("/admin").accept(MediaType.APPLICATION_JSON))
|
||||
this.mockMvc.perform(get("/admin/links").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk()).andExpect(jsonPath("$._links").exists());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user