testResponseContentLength1() — netty Function Reference
Architecture documentation for the testResponseContentLength1() function in HttpContentDecoderTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD d707417a_5b8f_bbec_2351_29716868fc76["testResponseContentLength1()"] ea4ec426_b689_ab52_a554_7959aed6c709["HttpContentDecoderTest"] d707417a_5b8f_bbec_2351_29716868fc76 -->|defined in| ea4ec426_b689_ab52_a554_7959aed6c709 e1fd631d_8d14_d190_2463_40108ec003a4["assertHasInboundMessages()"] d707417a_5b8f_bbec_2351_29716868fc76 -->|calls| e1fd631d_8d14_d190_2463_40108ec003a4 465668ef_fec3_d4d9_164f_24dc020645ba["assertHasOutboundMessages()"] d707417a_5b8f_bbec_2351_29716868fc76 -->|calls| 465668ef_fec3_d4d9_164f_24dc020645ba style d707417a_5b8f_bbec_2351_29716868fc76 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecoderTest.java lines 570–601
@Test
public void testResponseContentLength1() {
// case 1: test that ContentDecompressor either sets the correct Content-Length header
// or removes it completely (handlers down the chain must rely on LastHttpContent object)
// force content to be in more than one chunk (5 bytes/chunk)
HttpResponseDecoder decoder = new HttpResponseDecoder(4096, 4096, 5);
HttpContentDecoder decompressor = new HttpContentDecompressor(0);
EmbeddedChannel channel = new EmbeddedChannel(decoder, decompressor);
String headers = "HTTP/1.1 200 OK\r\n" +
"Content-Length: " + GZ_HELLO_WORLD.length + "\r\n" +
"Content-Encoding: gzip\r\n" +
"\r\n";
ByteBuf buf = Unpooled.copiedBuffer(headers.getBytes(CharsetUtil.US_ASCII), GZ_HELLO_WORLD);
assertTrue(channel.writeInbound(buf));
Queue<Object> resp = channel.inboundMessages();
assertTrue(resp.size() >= 1);
Object o = resp.peek();
assertInstanceOf(HttpResponse.class, o);
HttpResponse r = (HttpResponse) o;
assertFalse(r.headers().contains(HttpHeaderNames.CONTENT_LENGTH), "Content-Length header not removed.");
String transferEncoding = r.headers().get(HttpHeaderNames.TRANSFER_ENCODING);
assertNotNull(transferEncoding, "Content-length as well as transfer-encoding not set.");
assertEquals(HttpHeaderValues.CHUNKED.toString(), transferEncoding, "Unexpected transfer-encoding value.");
assertHasInboundMessages(channel, true);
assertHasOutboundMessages(channel, false);
assertFalse(channel.finish());
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testResponseContentLength1() do?
testResponseContentLength1() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecoderTest.java.
Where is testResponseContentLength1() defined?
testResponseContentLength1() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecoderTest.java at line 570.
What does testResponseContentLength1() call?
testResponseContentLength1() calls 2 function(s): assertHasInboundMessages, assertHasOutboundMessages.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free