Home / Function/ testChunkedContentWithTrailingHeader() — netty Function Reference

testChunkedContentWithTrailingHeader() — netty Function Reference

Architecture documentation for the testChunkedContentWithTrailingHeader() function in HttpContentEncoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ba8888db_5508_5202_291b_a9da7c34d648["testChunkedContentWithTrailingHeader()"]
  992a26d3_2083_aeb8_4785_63c545814355["HttpContentEncoderTest"]
  ba8888db_5508_5202_291b_a9da7c34d648 -->|defined in| 992a26d3_2083_aeb8_4785_63c545814355
  0a866c5b_d089_2acd_5353_fc5ee08af6b5["assertEncodedResponse()"]
  ba8888db_5508_5202_291b_a9da7c34d648 -->|calls| 0a866c5b_d089_2acd_5353_fc5ee08af6b5
  style ba8888db_5508_5202_291b_a9da7c34d648 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpContentEncoderTest.java lines 129–168

    @Test
    public void testChunkedContentWithTrailingHeader() throws Exception {
        EmbeddedChannel ch = new EmbeddedChannel(new TestEncoder());
        ch.writeInbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/"));

        HttpResponse res = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
        res.headers().set(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED);
        ch.writeOutbound(res);

        assertEncodedResponse(ch);

        ch.writeOutbound(new DefaultHttpContent(Unpooled.wrappedBuffer(new byte[3])));
        ch.writeOutbound(new DefaultHttpContent(Unpooled.wrappedBuffer(new byte[2])));
        LastHttpContent content = new DefaultLastHttpContent(Unpooled.wrappedBuffer(new byte[1]));
        content.trailingHeaders().set(of("X-Test"), of("Netty"));
        ch.writeOutbound(content);

        HttpContent chunk;
        chunk = ch.readOutbound();
        assertEquals("3", chunk.content().toString(CharsetUtil.US_ASCII));
        chunk.release();

        chunk = ch.readOutbound();
        assertEquals("2", chunk.content().toString(CharsetUtil.US_ASCII));
        chunk.release();

        chunk = ch.readOutbound();
        assertEquals("1", chunk.content().toString(CharsetUtil.US_ASCII));
        assertInstanceOf(HttpContent.class, chunk);
        chunk.release();

        chunk = ch.readOutbound();
        assertFalse(chunk.content().isReadable());
        assertInstanceOf(LastHttpContent.class, chunk);
        assertEquals("Netty", ((LastHttpContent) chunk).trailingHeaders().get(of("X-Test")));
        assertEquals(DecoderResult.SUCCESS, res.decoderResult());
        chunk.release();

        assertNull(ch.readOutbound());
    }

Domain

Subdomains

Frequently Asked Questions

What does testChunkedContentWithTrailingHeader() do?
testChunkedContentWithTrailingHeader() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentEncoderTest.java.
Where is testChunkedContentWithTrailingHeader() defined?
testChunkedContentWithTrailingHeader() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentEncoderTest.java at line 129.
What does testChunkedContentWithTrailingHeader() call?
testChunkedContentWithTrailingHeader() calls 1 function(s): assertEncodedResponse.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free