Home / Function/ testSingleFileUploadNoName() — netty Function Reference

testSingleFileUploadNoName() — netty Function Reference

Architecture documentation for the testSingleFileUploadNoName() function in HttpPostRequestEncoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  98d8d54d_9a56_4cef_ce6a_ad947ea68d1b["testSingleFileUploadNoName()"]
  3af766b2_b7f3_8257_aeb8_621a4404fee6["HttpPostRequestEncoderTest"]
  98d8d54d_9a56_4cef_ce6a_ad947ea68d1b -->|defined in| 3af766b2_b7f3_8257_aeb8_621a4404fee6
  style 98d8d54d_9a56_4cef_ce6a_ad947ea68d1b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoderTest.java lines 109–140

    @Test
    public void testSingleFileUploadNoName() throws Exception {
        DefaultFullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
                HttpMethod.POST, "http://localhost");

        HttpPostRequestEncoder encoder = new HttpPostRequestEncoder(request, true);
        File file1 = new File(getClass().getResource("/file-01.txt").toURI());
        encoder.addBodyAttribute("foo", "bar");
        encoder.addBodyFileUpload("quux", "", file1, "text/plain", false);

        String multipartDataBoundary = encoder.multipartDataBoundary;
        String content = getRequestBody(encoder);

        String expected = "--" + multipartDataBoundary + "\r\n" +
                CONTENT_DISPOSITION + ": form-data; name=\"foo\"" + "\r\n" +
                CONTENT_LENGTH + ": 3" + "\r\n" +
                CONTENT_TYPE + ": text/plain; charset=UTF-8" + "\r\n" +
                "\r\n" +
                "bar" +
                "\r\n" +
                "--" + multipartDataBoundary + "\r\n" +
                CONTENT_DISPOSITION + ": form-data; name=\"quux\"\r\n" +
                CONTENT_LENGTH + ": " + file1.length() + "\r\n" +
                CONTENT_TYPE + ": text/plain" + "\r\n" +
                CONTENT_TRANSFER_ENCODING + ": binary" + "\r\n" +
                "\r\n" +
                "File 01" + StringUtil.NEWLINE +
                "\r\n" +
                "--" + multipartDataBoundary + "--" + "\r\n";

        assertEquals(expected, content);
    }

Domain

Subdomains

Frequently Asked Questions

What does testSingleFileUploadNoName() do?
testSingleFileUploadNoName() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoderTest.java.
Where is testSingleFileUploadNoName() defined?
testSingleFileUploadNoName() is defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoderTest.java at line 109.

Analyze Your Own Codebase

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

Try Supermodel Free