use of org.webpieces.httpparser.api.dto.HttpRequest in project webpieces by deanhiller.
the class TestDevSynchronousErrors method testWebAppHasBugRenders500Route.
/**
* This tests bug in your webapp "/another" route, you could also test you have a bug in that route AND a bug in your internal
* server route as well!!!
*/
@Test
public void testWebAppHasBugRenders500Route() {
mockNotFoundLib.throwRuntime();
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_500_INTERNAL_SVR_ERROR);
response.assertContains("There was a bug in our software...sorry about that");
}
use of org.webpieces.httpparser.api.dto.HttpRequest in project webpieces by deanhiller.
the class TestDevSynchronousErrors method testWebappThrowsNotFound.
@Test
public void testWebappThrowsNotFound() {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/throwNotFound");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_404_NOTFOUND);
response.assertContains("Your app's webpage was not found");
}
use of org.webpieces.httpparser.api.dto.HttpRequest 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.httpparser.api.dto.HttpRequest 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.httpparser.api.dto.HttpRequest 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");
}
Aggregations