use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestDomainMatching method testStaticFileFromDomain2.
@Test
public void testStaticFileFromDomain2() {
HttpRequest req = Requests.createGetRequest("domain2.com", "/public/myfile");
httpsSocket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(httpsSocket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("org.webpieces.webserver");
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestDomainMatching method testDomain2RequestDomain1Route.
@Test
public void testDomain2RequestDomain1Route() {
HttpRequest req = Requests.createGetRequest("domain2.com", "/domain1");
httpsSocket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(httpsSocket);
response.assertStatusCode(KnownStatusCode.HTTP_404_NOTFOUND);
response.assertContains("Your page was not found");
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestDomainMatching method testStaticDirFromDomain2.
@Test
public void testStaticDirFromDomain2() {
HttpRequest req = Requests.createGetRequest("domain2.com", "/public/asyncMeta.txt");
httpsSocket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(httpsSocket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("org.webpieces.webserver");
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestJson method testSyncWriteOnlyPost.
@Test
public void testSyncWriteOnlyPost() {
HttpDummyRequest req = Requests.createJsonRequest(KnownHttpMethod.POST, "/json/write");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
Assert.assertEquals("", response.getBodyAsString());
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestJson method testRouteParamConversionFail.
@Test
public void testRouteParamConversionFail() {
HttpDummyRequest req = Requests.createBadJsonRequest(KnownHttpMethod.POST, "/json/somenotexistroute");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
//clearly this url has nothing there
response.assertStatusCode(KnownStatusCode.HTTP_404_NOTFOUND);
response.assertContains("{`error`:`This url has no api. try another url`,`code`:0}".replace("`", "\""));
response.assertContentType("application/json");
}
Aggregations