Home / Function/ is_body_allowed_for_status_code() — fastapi Function Reference

is_body_allowed_for_status_code() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  dba5a7c0_1fab_8f88_2c80_2b79c3b3dc47["is_body_allowed_for_status_code()"]
  1c2c0e68_6ed1_7632_8c35_00818f97b599["utils.py"]
  dba5a7c0_1fab_8f88_2c80_2b79c3b3dc47 -->|defined in| 1c2c0e68_6ed1_7632_8c35_00818f97b599
  b7aaa327_256c_826b_6da4_7f2714292af0["http_exception_handler()"]
  b7aaa327_256c_826b_6da4_7f2714292af0 -->|calls| dba5a7c0_1fab_8f88_2c80_2b79c3b3dc47
  200f313e_38b9_296f_f9aa_afdeacb6b8ad["get_openapi_path()"]
  200f313e_38b9_296f_f9aa_afdeacb6b8ad -->|calls| dba5a7c0_1fab_8f88_2c80_2b79c3b3dc47
  ad8d62d9_53da_514b_c06f_53293eb1e5ae["get_request_handler()"]
  ad8d62d9_53da_514b_c06f_53293eb1e5ae -->|calls| dba5a7c0_1fab_8f88_2c80_2b79c3b3dc47
  d8b4fb83_3521_0b7e_fcfa_0c7f161ca116["__init__()"]
  d8b4fb83_3521_0b7e_fcfa_0c7f161ca116 -->|calls| dba5a7c0_1fab_8f88_2c80_2b79c3b3dc47
  style dba5a7c0_1fab_8f88_2c80_2b79c3b3dc47 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/utils.py lines 28–42

def is_body_allowed_for_status_code(status_code: Union[int, str, None]) -> bool:
    if status_code is None:
        return True
    # Ref: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#patterned-fields-1
    if status_code in {
        "default",
        "1XX",
        "2XX",
        "3XX",
        "4XX",
        "5XX",
    }:
        return True
    current_status_code = int(status_code)
    return not (current_status_code < 200 or current_status_code in {204, 205, 304})

Domain

Subdomains

Defined In

Frequently Asked Questions

What does is_body_allowed_for_status_code() do?
is_body_allowed_for_status_code() is a function in the fastapi codebase, defined in fastapi/utils.py.
Where is is_body_allowed_for_status_code() defined?
is_body_allowed_for_status_code() is defined in fastapi/utils.py at line 28.
What calls is_body_allowed_for_status_code()?
is_body_allowed_for_status_code() is called by 4 function(s): __init__, get_openapi_path, get_request_handler, http_exception_handler.

Analyze Your Own Codebase

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

Try Supermodel Free