예제 #1
0
  @Test
  public void testBasicGet() throws Throwable {
    Map<String, Object> response =
        client.execute(
            prepareGet().setUri(server.getBaseUrl().resolve("/foo")).build(),
            createJsonResponseHandler(mapJsonCodec(String.class, Object.class)));

    assertEquals(response.get("REQUEST_METHOD"), "GET");
    assertEquals(response.get("SCRIPT_NAME"), "");
    assertEquals(response.get("PATH_INFO"), "/foo");
    assertEquals(response.get("QUERY_STRING"), "");
  }
예제 #2
0
  @Test
  public void testGetWithEscaping() throws Throwable {
    String path = "/hello%20world+bye";

    Map<String, Object> response =
        client.execute(
            prepareGet().setUri(server.getBaseUrl().resolve(path + "?foo%2Fbar=123%20999")).build(),
            createJsonResponseHandler(mapJsonCodec(String.class, Object.class)));

    assertEquals(response.get("REQUEST_METHOD"), "GET");
    assertEquals(response.get("SCRIPT_NAME"), "");
    assertEquals(response.get("PATH_INFO"), "/hello%20world+bye");
    // todo Jetty client mangles this       assertEquals(response.get("QUERY_STRING"),
    // "foo%2Fbar=123%20999");
  }