Home / Function/ shouldThrowExceptionIfNotAllowed() — netty Function Reference

shouldThrowExceptionIfNotAllowed() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  021481da_de80_d081_59fd_8f6466f077e6["shouldThrowExceptionIfNotAllowed()"]
  3af766b2_b7f3_8257_aeb8_621a4404fee6["HttpPostRequestEncoderTest"]
  021481da_de80_d081_59fd_8f6466f077e6 -->|defined in| 3af766b2_b7f3_8257_aeb8_621a4404fee6
  7239bc5f_2050_7a39_2ab6_ce37c9eeeeaf["testAllowedMethods()"]
  7239bc5f_2050_7a39_2ab6_ce37c9eeeeaf -->|calls| 021481da_de80_d081_59fd_8f6466f077e6
  style 021481da_de80_d081_59fd_8f6466f077e6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoderTest.java lines 77–107

    private void shouldThrowExceptionIfNotAllowed(HttpMethod method) throws Exception {
        DefaultFullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
                method, "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\"; filename=\"file-01.txt\"" + "\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 shouldThrowExceptionIfNotAllowed() do?
shouldThrowExceptionIfNotAllowed() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoderTest.java.
Where is shouldThrowExceptionIfNotAllowed() defined?
shouldThrowExceptionIfNotAllowed() is defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoderTest.java at line 77.
What calls shouldThrowExceptionIfNotAllowed()?
shouldThrowExceptionIfNotAllowed() is called by 1 function(s): testAllowedMethods.

Analyze Your Own Codebase

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

Try Supermodel Free