Home / Function/ test_post_broken_body() — fastapi Function Reference

test_post_broken_body() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e592372b_cfb6_2f0b_8a27_8c9b1c30c8e1["test_post_broken_body()"]
  384ebf37_bf33_dd11_7410_101f39082f41["test_tutorial001.py"]
  e592372b_cfb6_2f0b_8a27_8c9b1c30c8e1 -->|defined in| 384ebf37_bf33_dd11_7410_101f39082f41
  style e592372b_cfb6_2f0b_8a27_8c9b1c30c8e1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_tutorial/test_body/test_tutorial001.py lines 140–157

def test_post_broken_body(client: TestClient):
    response = client.post(
        "/items/",
        headers={"content-type": "application/json"},
        content="{some broken json}",
    )
    assert response.status_code == 422, response.text
    assert response.json() == {
        "detail": [
            {
                "type": "json_invalid",
                "loc": ["body", 1],
                "msg": "JSON decode error",
                "input": {},
                "ctx": {"error": "Expecting property name enclosed in double quotes"},
            }
        ]
    }

Domain

Subdomains

Frequently Asked Questions

What does test_post_broken_body() do?
test_post_broken_body() is a function in the fastapi codebase, defined in tests/test_tutorial/test_body/test_tutorial001.py.
Where is test_post_broken_body() defined?
test_post_broken_body() is defined in tests/test_tutorial/test_body/test_tutorial001.py at line 140.

Analyze Your Own Codebase

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

Try Supermodel Free