Prevent empty json for parameters in trace endpoint

Fixes gh-8883
This commit is contained in:
Madhura Bhave
2017-04-11 15:08:17 -07:00
parent 404bb2d171
commit b2f0ebfcb8
2 changed files with 23 additions and 1 deletions

View File

@@ -187,6 +187,22 @@ public class SampleActuatorApplicationTests {
assertThat(map.get("status")).isEqualTo("200");
}
@Test
public void traceWithParameterMap() throws Exception {
this.restTemplate.getForEntity("/health?param1=value1", String.class);
@SuppressWarnings("rawtypes")
ResponseEntity<List> entity = this.restTemplate
.withBasicAuth("user", getPassword()).getForEntity("/trace", List.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@SuppressWarnings("unchecked")
List<Map<String, Object>> list = entity.getBody();
Map<String, Object> trace = list.get(0);
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) ((Map<String, Object>)trace
.get("info")).get("parameters");
assertThat(map.get("param1")).isNotNull();
}
@Test
public void testErrorPageDirectAccess() throws Exception {
@SuppressWarnings("rawtypes")