-
-
Notifications
You must be signed in to change notification settings - Fork 131
Open
Labels
enhancementNew feature or requestNew feature or request
Description
@mkurnikov @intgr @sobolevn Thanks for you work! I guess my question is related to #60
I wonder if there's a way for the decorator api_view
to propagate the constant http_method_names
as Union of Literals attached to Request.method? Consider the following example:
@api_view(["GET", "POST"])
def my_view(request: Request) -> Response:
reveal_type(request.method)
if request.method == "GET":
return Response({})
elif request.method == "POST":
return Response({})
mypy yields
views.py:2: error: Missing return statement
views.py:3: note: Revealed type is 'Union[builtins.str, None]'
Or how would you suppress this error?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request