Skip to content

Commit

Permalink
Fix bug in return of method wrapped
Browse files Browse the repository at this point in the history
  • Loading branch information
nycholas committed Nov 15, 2022
1 parent 4430ad7 commit 9c91e81
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/flask_jsonrpc/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _method_has_parameters(self, fn: t.Callable[..., t.Any]) -> bool:

def _method_has_return(self, fn: t.Callable[..., t.Any]) -> bool:
fn_annotations = t.get_type_hints(fn)
return 'return' in fn_annotations
return 'return' in fn_annotations and fn_annotations['return'] is not type(None)

def _validate(self, fn: t.Callable[..., t.Any]) -> bool:
if not self._method_has_parameters(fn) and not self._method_has_return(fn):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def index() -> str:

# pylint: disable=W0612
@jsonrpc.method('app.fn0')
def fn0():
def fn0() -> None:
pass

# pylint: disable=W0612
Expand Down Expand Up @@ -157,7 +157,7 @@ def test_app_create_with_method_without_annotation_on_params():

# pylint: disable=W0612
@jsonrpc.method('app.fn4')
def fn4():
def fn4() -> None:
pass

# pylint: disable=W0612
Expand Down

0 comments on commit 9c91e81

Please sign in to comment.