Add support for POSTing a single POJO
You need to cache the request body so it can be read twice, once to see if it's an array, and again to turn it into a POJO.
This commit is contained in:
@@ -273,6 +273,16 @@ public class RestApplicationTests {
|
||||
.isEqualTo("[{\"value\":\"FOO\"},{\"value\":\"BAR\"}]");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uppercaseFoo() throws Exception {
|
||||
// Single Foo can be parsed
|
||||
ResponseEntity<String> result = rest.exchange(RequestEntity
|
||||
.post(new URI("/upFoos")).contentType(MediaType.APPLICATION_JSON)
|
||||
.body("{\"value\":\"foo\"}"), String.class);
|
||||
assertThat(result.getBody())
|
||||
.isEqualTo("[{\"value\":\"FOO\"}]");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bareUppercase() throws Exception {
|
||||
ResponseEntity<String> result = rest.exchange(RequestEntity
|
||||
|
||||
Reference in New Issue
Block a user