use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method testEchoParam3.
@Test
public void testEchoParam3() throws Exception {
String polyglot = "жξ Ä 聊";
String encoded = URIUtil.encodePath(polyglot);
UrlResponse response = testUtil.doMethod("GET", "/param/" + encoded, null);
Assert.assertEquals(200, response.status);
Assert.assertEquals("echo: " + polyglot, response.body);
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method testSplatWithEncodedSlash.
@Test
public void testSplatWithEncodedSlash() throws Exception {
String param = "fo/shizzle";
String encodedParam = URLEncoder.encode(param, "UTF-8");
String splat = "mah/FRIEND";
String encodedSplat = URLEncoder.encode(splat, "UTF-8");
UrlResponse response = testUtil.doMethod("GET", "/paramandwild/" + encodedParam + "/stuff/" + encodedSplat, null);
Assert.assertEquals(200, response.status);
Assert.assertEquals("paramandwild: " + param + splat, response.body);
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method testGetByteBufferHi.
@Test
public void testGetByteBufferHi() {
try {
UrlResponse response = testUtil.doMethod("GET", "/bytebufferhi", null);
Assert.assertEquals(200, response.status);
Assert.assertEquals("Hello World!", response.body);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method testPostViaGetWithMethodOverrideHeader.
@Test
public void testPostViaGetWithMethodOverrideHeader() throws IOException {
Map<String, String> map = new HashMap<>();
map.put("X-HTTP-Method-Override", "POST");
UrlResponse response = testUtil.doMethod("GET", "/post_via_get", "Fo shizzy", false, "*/*", map);
System.out.println(response.body);
Assert.assertEquals(201, response.status);
Assert.assertTrue(response.body.contains("Method Override Worked"));
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method testGetBinaryHi.
@Test
public void testGetBinaryHi() {
try {
UrlResponse response = testUtil.doMethod("GET", "/binaryhi", null);
Assert.assertEquals(200, response.status);
Assert.assertEquals("Hello World!", response.body);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
Aggregations