Search in sources :

Example 26 with HttpResponse

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

the class TestResponseParsing method testAsciiConverter.

@Test
public void testAsciiConverter() {
    HttpResponse response = createOkResponse();
    byte[] payload = unwrap(parser.marshalToByteBuffer(state, response));
    ConvertAscii converter = new ConvertAscii();
    String readableForm = converter.convertToReadableForm(payload);
    Assert.assertEquals("HTTP/1.1\\s 200\\s OK\\r\\n\r\n" + "Accept:\\s CooolValue\\r\\n\r\n" + "CustomerHEADER:\\s betterValue\\r\\n\r\n" + "\\r\\n\r\n", readableForm);
}
Also used : ConvertAscii(org.webpieces.httpparser.impl.ConvertAscii) HttpResponse(org.webpieces.httpparser.api.dto.HttpResponse) Test(org.junit.Test)

Aggregations

HttpResponse (org.webpieces.httpparser.api.dto.HttpResponse)26 Test (org.junit.Test)17 Header (org.webpieces.httpparser.api.common.Header)15 HttpPayload (org.webpieces.httpparser.api.dto.HttpPayload)13 DataWrapper (org.webpieces.data.api.DataWrapper)12 Http2Response (com.webpieces.hpack.api.dto.Http2Response)7 HttpResponseStatus (org.webpieces.httpparser.api.dto.HttpResponseStatus)7 HttpResponseStatusLine (org.webpieces.httpparser.api.dto.HttpResponseStatusLine)7 PassedIn (org.webpieces.httpfrontend2.api.mock2.MockHttp2RequestListener.PassedIn)6 HttpChunk (org.webpieces.httpparser.api.dto.HttpChunk)6 HttpRequest (org.webpieces.httpparser.api.dto.HttpRequest)6 HttpData (org.webpieces.httpparser.api.dto.HttpData)5 StreamWriter (com.webpieces.http2engine.api.StreamWriter)4 DataFrame (com.webpieces.http2parser.api.dto.DataFrame)4 Http2Header (com.webpieces.http2parser.api.dto.lib.Http2Header)4 HttpLastChunk (org.webpieces.httpparser.api.dto.HttpLastChunk)4 CompletableFuture (java.util.concurrent.CompletableFuture)2 PushStreamHandle (com.webpieces.http2engine.api.PushStreamHandle)1 Http2HeaderName (com.webpieces.http2parser.api.dto.lib.Http2HeaderName)1 Http2Msg (com.webpieces.http2parser.api.dto.lib.Http2Msg)1