Home / Function/ test_custom_middleware_exception() — fastapi Function Reference

test_custom_middleware_exception() — fastapi Function Reference

Architecture documentation for the test_custom_middleware_exception() function in test_custom_middleware_exception.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  b937ef51_5671_b055_5b54_3fdb89bbbb56["test_custom_middleware_exception()"]
  701a2e1b_486c_9b9e_27dc_b223ac1a3925["test_custom_middleware_exception.py"]
  b937ef51_5671_b055_5b54_3fdb89bbbb56 -->|defined in| 701a2e1b_486c_9b9e_27dc_b223ac1a3925
  style b937ef51_5671_b055_5b54_3fdb89bbbb56 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_custom_middleware_exception.py lines 69–84

def test_custom_middleware_exception(tmp_path: Path):
    default_pydantic_max_size = 2**16
    path = tmp_path / "test.txt"
    path.write_bytes(b"x" * (default_pydantic_max_size + 1))

    with client:
        with open(path, "rb") as file:
            response = client.post("/middleware", files={"file": file})
        assert response.status_code == 422, response.text
        assert response.json() == {
            "detail": {
                "name": "ContentSizeLimitExceeded",
                "code": 999,
                "message": "File limit exceeded",
            }
        }

Domain

Subdomains

Frequently Asked Questions

What does test_custom_middleware_exception() do?
test_custom_middleware_exception() is a function in the fastapi codebase, defined in tests/test_custom_middleware_exception.py.
Where is test_custom_middleware_exception() defined?
test_custom_middleware_exception() is defined in tests/test_custom_middleware_exception.py at line 69.

Analyze Your Own Codebase

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

Try Supermodel Free