use of com.webpieces.http2.api.dto.highlevel.Http2Response in project webpieces by deanhiller.
the class ResponseCreator method addCommonHeaders.
public Http2Response addCommonHeaders(Http2Request request, String responseMimeType, boolean isDynamicPartOfWebsite, int statusCode, String statusReason) {
Http2Response response = addCommonHeaders2(request, responseMimeType, statusCode, statusReason);
boolean isInternalError = statusCode >= 500 && statusCode < 600;
if (isDynamicPartOfWebsite) {
List<RouterCookie> cookies = createCookies(isInternalError);
for (RouterCookie c : cookies) {
Http2Header cookieHeader = create(c);
response.addHeader(cookieHeader);
}
}
return response;
}
use of com.webpieces.http2.api.dto.highlevel.Http2Response in project webpieces by deanhiller.
the class ResponseCreator method addDeleteCookie.
public void addDeleteCookie(Http2Response response, String badCookieName) {
RouterCookie cookie = cookieTranslator.createDeleteCookie(badCookieName);
Http2Header cookieHeader = create(cookie);
response.addHeader(cookieHeader);
}
use of com.webpieces.http2.api.dto.highlevel.Http2Response in project webpieces by deanhiller.
the class Requests method createResponse.
public static Http2Response createResponse(int streamId) {
List<Http2Header> headers = new ArrayList<>();
headers.add(new Http2Header(Http2HeaderName.STATUS, String.valueOf(StatusCode.HTTP_200_OK.getCode())));
headers.add(new Http2Header(Http2HeaderName.SERVER, "me"));
Http2Response response = new Http2Response(headers);
response.setEndOfStream(false);
response.setStreamId(streamId);
return response;
}
use of com.webpieces.http2.api.dto.highlevel.Http2Response in project webpieces by deanhiller.
the class Requests method createEosResponse.
public static Http2Response createEosResponse(int streamId) {
List<Http2Header> headers = new ArrayList<>();
headers.add(new Http2Header(Http2HeaderName.STATUS, String.valueOf(StatusCode.HTTP_200_OK.getCode())));
headers.add(new Http2Header(Http2HeaderName.SERVER, "me"));
Http2Response response = new Http2Response(headers);
response.setEndOfStream(true);
response.setStreamId(streamId);
return response;
}
use of com.webpieces.http2.api.dto.highlevel.Http2Response in project webpieces by deanhiller.
the class TestSBasicRequestResponse method testWithNoData.
@Test
public void testWithNoData() throws InterruptedException, ExecutionException, TimeoutException {
Http2Request request1 = Http2Requests.createRequest(1, true);
mockChannel.send(request1);
PassedIn incoming = mockListener.getSingleRequest();
Assert.assertEquals(request1, incoming.request);
Http2Response resp = Http2Requests.createResponse(request1.getStreamId(), true);
incoming.stream.process(resp);
Http2Msg response = mockChannel.getFrameAndClear();
Assert.assertEquals(resp, response);
}
Aggregations