@Test public void preservesOriginalResponseEncodingWhenDecorating() throws Exception { layout.connectTo((request, response) -> response.body("encoded content (éçëœ)")); response.contentType("text/html; charset=utf-8"); layout.handle(request, response); response.done(); assertNoExecutionError(); assertThat(response) .hasContentType("text/html; charset=utf-8") .hasBodyEncoding(UTF_8) .hasBodyText(containsString("éçëœ")); }
public void pong(Request request, Response response) throws Exception { response.contentType(JSON).body(gson.toJson(new Pong())); }