MCPcopy
hub / github.com/fastapi/fastapi / is_body_allowed_for_status_code

Function is_body_allowed_for_status_code

fastapi/utils.py:26–40  ·  view source on GitHub ↗
(status_code: int | str | None)

Source from the content-addressed store, hash-verified

24
25
26def is_body_allowed_for_status_code(status_code: int | str | None) -> bool:
27 if status_code is None:
28 return True
29 # Ref: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#patterned-fields-1
30 if status_code in {
31 "default",
32 "1XX",
33 "2XX",
34 "3XX",
35 "4XX",
36 "5XX",
37 }:
38 return True
39 current_status_code = int(status_code)
40 return not (current_status_code < 200 or current_status_code in {204, 205, 304})
41
42
43def get_path_param_names(path: str) -> set[str]:

Callers 4

http_exception_handlerFunction · 0.90
appFunction · 0.90
get_openapi_pathFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…