Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NoneType return type for 204 endpoints #5860

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
7 changes: 6 additions & 1 deletion fastapi/dependencies/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,12 @@ def get_typed_return_annotation(call: Callable[..., Any]) -> Any:
return None

globalns = getattr(call, "__globals__", {})
return get_typed_annotation(annotation, globalns)
typed_annotation = get_typed_annotation(annotation, globalns)

if typed_annotation is type(None): # noqa: E721
return None

return typed_annotation


def get_dependant(
Expand Down