Disable hypermedia in actuator endpoints by default

This change permanently removes links from the endpoints that return
arrays or collections, and also disables them in the rest of the
endpoints (except /actuator) by default.

Fixes gh-4616
This commit is contained in:
Dave Syer
2015-12-16 10:58:54 +00:00
parent 860a9b94ea
commit c7c685f65f
7 changed files with 138 additions and 17 deletions

View File

@@ -37,7 +37,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(SampleHypermediaGsonApplication.class)
@WebAppConfiguration
@TestPropertySource(properties = "endpoints.health.sensitive: false")
@TestPropertySource(properties = "endpoints.hypermedia.enabled: true")
public class SampleHypermediaGsonApplicationTests {
@Autowired
@@ -61,9 +61,8 @@ public class SampleHypermediaGsonApplicationTests {
@Test
public void trace() throws Exception {
this.mockMvc.perform(get("/trace").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$.links[0].href").value("http://localhost/trace"))
.andExpect(jsonPath("$.content").isArray());
.andExpect(status().isOk()).andExpect(jsonPath("$.links").doesNotExist())
.andExpect(jsonPath("$").isArray());
}
@Test