Return actual status code not 200 to machine client

Machine clients are much more fussy than browsers and we
should take care to preserve the HTTP status for them.

Fixes gh-596
This commit is contained in:
Dave Syer
2014-03-27 17:22:04 +00:00
parent d13827c45c
commit 71c2c69c92
4 changed files with 17 additions and 7 deletions

View File

@@ -50,7 +50,7 @@ public class EndpointsPropertiesSampleActuatorApplicationTests {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = RestTemplates.get("user", "password").getForEntity(
"http://localhost:8080/oops", Map.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, entity.getStatusCode());
@SuppressWarnings("unchecked")
Map<String, Object> body = entity.getBody();
assertEquals("None", body.get("error"));

View File

@@ -158,7 +158,7 @@ public class SampleActuatorApplicationTests {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = RestTemplates.get().getForEntity(
"http://localhost:8080/error", Map.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, entity.getStatusCode());
@SuppressWarnings("unchecked")
Map<String, Object> body = entity.getBody();
assertEquals("None", body.get("error"));