예제 #1
0
  @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("éçëœ"));
  }
예제 #2
0
 public void pong(Request request, Response response) throws Exception {
   response.contentType(JSON).body(gson.toJson(new Pong()));
 }