Search in sources :

Example 1 with HttpRequest

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");
}
Also used : HttpRequest(org.webpieces.httpparser.api.dto.HttpRequest) FullResponse(org.webpieces.webserver.test.FullResponse) Test(org.junit.Test) WebserverForTest(org.webpieces.webserver.WebserverForTest) AbstractWebpiecesTest(org.webpieces.webserver.test.AbstractWebpiecesTest)

Example 2 with HttpRequest

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");
}
Also used : HttpRequest(org.webpieces.httpparser.api.dto.HttpRequest) FullResponse(org.webpieces.webserver.test.FullResponse) Test(org.junit.Test) WebserverForTest(org.webpieces.webserver.WebserverForTest) AbstractWebpiecesTest(org.webpieces.webserver.test.AbstractWebpiecesTest)

Example 3 with HttpRequest

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");
}
Also used : HttpRequest(org.webpieces.httpparser.api.dto.HttpRequest) FullResponse(org.webpieces.webserver.test.FullResponse) Test(org.junit.Test) WebserverForTest(org.webpieces.webserver.WebserverForTest) AbstractWebpiecesTest(org.webpieces.webserver.test.AbstractWebpiecesTest)

Example 4 with HttpRequest

use of org.webpieces.httpparser.api.dto.HttpRequest in project webpieces by deanhiller.

the class TestJson method testReadOnly.

@Test
public void testReadOnly() {
    HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/json/read");
    http11Socket.send(req);
    FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
    response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
    response.assertContains("{`searchTime`:1,`matches`:[]}".replace("`", "\""));
    response.assertContentType("application/json");
}
Also used : HttpRequest(org.webpieces.httpparser.api.dto.HttpRequest) FullResponse(org.webpieces.webserver.test.FullResponse) Test(org.junit.Test) AbstractWebpiecesTest(org.webpieces.webserver.test.AbstractWebpiecesTest) WebserverForTest(org.webpieces.webserver.WebserverForTest)

Example 5 with HttpRequest

use of org.webpieces.httpparser.api.dto.HttpRequest in project webpieces by deanhiller.

the class TestDomainMatching method testStaticDirFromDomain1.

@Test
public void testStaticDirFromDomain1() {
    HttpRequest req = Requests.createGetRequest("mydomain.com", "/public/asyncMeta.txt");
    httpsSocket.send(req);
    FullResponse response = ResponseExtract.assertSingleResponse(httpsSocket);
    response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
    response.assertContains("org.webpieces.webserver");
}
Also used : HttpRequest(org.webpieces.httpparser.api.dto.HttpRequest) FullResponse(org.webpieces.webserver.test.FullResponse) Test(org.junit.Test) WebserverForTest(org.webpieces.webserver.WebserverForTest) AbstractWebpiecesTest(org.webpieces.webserver.test.AbstractWebpiecesTest)

Aggregations

HttpRequest (org.webpieces.httpparser.api.dto.HttpRequest)74 Test (org.junit.Test)40 Header (org.webpieces.httpparser.api.common.Header)40 HttpRequestLine (org.webpieces.httpparser.api.dto.HttpRequestLine)24 HttpUri (org.webpieces.httpparser.api.dto.HttpUri)24 DataWrapper (org.webpieces.data.api.DataWrapper)23 FullResponse (org.webpieces.webserver.test.FullResponse)19 AbstractWebpiecesTest (org.webpieces.webserver.test.AbstractWebpiecesTest)18 HttpData (org.webpieces.httpparser.api.dto.HttpData)14 HttpFullRequest (org.webpieces.httpclient11.api.HttpFullRequest)12 PassedIn (org.webpieces.httpfrontend2.api.mock2.MockHttp2RequestListener.PassedIn)12 WebserverForTest (org.webpieces.webserver.WebserverForTest)12 Http2Header (com.webpieces.http2.api.dto.lowlevel.lib.Http2Header)11 HttpPayload (org.webpieces.httpparser.api.dto.HttpPayload)11 HttpResponse (org.webpieces.httpparser.api.dto.HttpResponse)10 Http2Response (com.webpieces.http2.api.dto.highlevel.Http2Response)9 StreamWriter (com.webpieces.http2.api.streaming.StreamWriter)7 DataFrame (com.webpieces.http2.api.dto.lowlevel.DataFrame)6 InetSocketAddress (java.net.InetSocketAddress)4 HttpRequestMethod (org.webpieces.httpparser.api.dto.HttpRequestMethod)4