Package jodd.http

Examples of jodd.http.HttpResponse.contentType()


  @Test
  public void testRawResult() {
    HttpResponse httpResponse = HttpRequest.get("localhost:8173/madvocRawImage").send();
    assertEquals(200, httpResponse.statusCode());
    assertEquals("image/gif", httpResponse.contentType());
    byte[] bytes = httpResponse.bodyBytes();
    assertArrayEquals(RawResultAction.SMALLEST_GIF, bytes);
  }

  // ---------------------------------------------------------------- text
View Full Code Here


  @Test
  public void testEncoding() {
    HttpResponse httpResponse = HttpRequest.get("localhost:8173/madvocEncoding").send();
    assertEquals(200, httpResponse.statusCode());
    assertEquals("text/plain;charset=UTF-8", httpResponse.contentType());
    assertEquals("this text contents chinese chars 中文", httpResponse.bodyText());
  }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.