use of org.webpieces.httpclient11.api.HttpFullRequest in project webpieces by deanhiller.
the class TestGetCorsRouting method testCookie200Ok.
@Test
public void testCookie200Ok() {
String cookieValue = "key1=value1;key2=value2";
List<String> accessHeaders = List.of("Authorization", "asfsf");
HttpFullRequest req = Requests.createCorsRequestCookie(CorsForTwoDomains.DOMAIN1, "/content", accessHeaders, KnownHttpMethod.PUT, cookieValue);
XFuture<HttpFullResponse> respFuture = httpsSocket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
}
use of org.webpieces.httpclient11.api.HttpFullRequest in project webpieces by deanhiller.
the class TestHttps method testReverseUrlLookupOnHttpPageForHttpsUrl.
@Test
public void testReverseUrlLookupOnHttpPageForHttpsUrl() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/same");
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
// since request came in on port 80, url should be port 443
// notice the Https Route page is not shown
response.assertContains("https://myhost.com:443");
}
use of org.webpieces.httpclient11.api.HttpFullRequest in project webpieces by deanhiller.
the class TestHttps method testSecureLoginNotFoundHttpsPage.
@Test
public void testSecureLoginNotFoundHttpsPage() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/secure/notFoundPage");
XFuture<HttpFullResponse> respFuture = https11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
// Page not exist
response.assertStatusCode(KnownStatusCode.HTTP_404_NOTFOUND);
}
use of org.webpieces.httpclient11.api.HttpFullRequest in project webpieces by deanhiller.
the class TestHttps method testSecureLoginHasHttpsPage.
@Test
public void testSecureLoginHasHttpsPage() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/secure/internal");
XFuture<HttpFullResponse> respFuture = https11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
// before we can show you the page, you need to be logged in, redirect to login page...
response.assertStatusCode(KnownStatusCode.HTTP_303_SEEOTHER);
}
use of org.webpieces.httpclient11.api.HttpFullRequest in project webpieces by deanhiller.
the class TestHttps method testSameRouteHttpAndHttpsWrongOrder.
@Test
public void testSameRouteHttpAndHttpsWrongOrder() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/same");
XFuture<HttpFullResponse> respFuture1 = https11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture1);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
// notice the Https Route page is not shown
response.assertContains("Http Route");
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
// notice the Https Route page is not shown
response.assertContains("Http Route");
}
Aggregations