Package jodd.http

Examples of jodd.http.HttpResponse.bodyText()


  }

  @Test
  public void testRestAction1() {
    HttpResponse response = HttpRequest.get("localhost:8173/re/view/123").send();
    assertEquals("123", response.bodyText().trim());
  }

  @Test
  public void testRestAction2() {
    HttpResponse response = HttpRequest.get("localhost:8173/re/view2/g-321.html").send();
View Full Code Here


  public void testRestAction2() {
    HttpResponse response = HttpRequest.get("localhost:8173/re/view2/g-321.html").send();
    assertEquals(302, response.statusCode());

    response = HttpRequest.get(response.header("location")).send();
    assertEquals("321", response.bodyText().trim());
  }

  @Test
  public void testRestAction3() {
    HttpResponse response = HttpRequest.get("localhost:8173/re/view3/555").send();
View Full Code Here

  }

  @Test
  public void testRestAction3() {
    HttpResponse response = HttpRequest.get("localhost:8173/re/view3/555").send();
    assertEquals("555", response.bodyText().trim());
  }

  @Test
  public void testRestAction3_nomatch() {
    HttpResponse response = HttpRequest.get("localhost:8173/re/view3/1x2").send();
View Full Code Here

  }

  @Test
  public void testMissingAction() {
    HttpResponse response = HttpRequest.get("localhost:8173/missing.html?data.miss=123").send();
    assertEquals(":null", response.bodyText().trim());
  }

}
View Full Code Here

  @Test
  public void testException() {
    HttpBrowser httpBrowser = new HttpBrowser();
    HttpResponse response = httpBrowser.sendRequest(HttpRequest.get("localhost:8173/exc.html"));

    assertEquals("500!", response.bodyText().trim());
  }

  @Test
  public void testRedirect500() {
    HttpBrowser httpBrowser = new HttpBrowser();
View Full Code Here

  @Test
  public void testRedirect500() {
    HttpBrowser httpBrowser = new HttpBrowser();
    HttpResponse response = httpBrowser.sendRequest(HttpRequest.get("localhost:8173/exc.red.html"));

    assertEquals("500!", response.bodyText().trim());
  }
}
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

    String location = response.header("location");

    response = HttpRequest.get(location).send();

    assertEquals("33hello.txt 33uploadFiles[1] a1 a2 ", response.bodyText());
  }

}
View Full Code Here

  }

  @Test
  public void testFilterAction() {
    HttpResponse response = HttpRequest.get("localhost:8173/filter.html").send();
    assertEquals("Hello.peep!peep!", response.bodyText().trim());
  }

}
View Full Code Here

  }

  @Test
  public void testTypesOne() {
    HttpResponse response = HttpRequest.get("localhost:8173/types.one.html").query("listA","1,2,3").send();
    assertEquals("+ [1, 2, 3]2", response.bodyText().trim());
  }

}
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.