Jackson encoder skips String.class

Jackson2Encoder explicitly disables String from the supported types
consistent with the same change on the decoder side:

0662dbf044

Issue: SPR-15443
This commit is contained in:
Rossen Stoyanchev
2017-04-14 17:18:44 -04:00
parent 2ba4a224a6
commit 3efb76c852
7 changed files with 43 additions and 16 deletions

View File

@@ -291,7 +291,7 @@ public class ResponseEntityResultHandlerTests {
this.resultHandler.handleResult(exchange, result).block(Duration.ofSeconds(5));
assertEquals(HttpStatus.OK, exchange.getResponse().getStatusCode());
assertResponseBody(exchange, "\"body\"");
assertResponseBody(exchange, "body");
}
@Test // SPR-14877

View File

@@ -67,11 +67,11 @@ public class HttpMessageWriterViewTests {
@Test
public void singleMatch() throws Exception {
this.view.setModelKeys(Collections.singleton("foo2"));
this.model.addAttribute("foo1", "bar1");
this.model.addAttribute("foo2", "bar2");
this.model.addAttribute("foo3", "bar3");
this.model.addAttribute("foo1", Collections.singleton("bar1"));
this.model.addAttribute("foo2", Collections.singleton("bar2"));
this.model.addAttribute("foo3", Collections.singleton("bar3"));
assertEquals("\"bar2\"", doRender());
assertEquals("[\"bar2\"]", doRender());
}
@Test
@@ -94,11 +94,11 @@ public class HttpMessageWriterViewTests {
@Test
public void multipleMatches() throws Exception {
this.view.setModelKeys(new HashSet<>(Arrays.asList("foo1", "foo2")));
this.model.addAttribute("foo1", "bar1");
this.model.addAttribute("foo2", "bar2");
this.model.addAttribute("foo3", "bar3");
this.model.addAttribute("foo1", Collections.singleton("bar1"));
this.model.addAttribute("foo2", Collections.singleton("bar2"));
this.model.addAttribute("foo3", Collections.singleton("bar3"));
assertEquals("{\"foo1\":\"bar1\",\"foo2\":\"bar2\"}", doRender());
assertEquals("{\"foo1\":[\"bar1\"],\"foo2\":[\"bar2\"]}", doRender());
}
@Test