Skip to content

Commit fdfac96

Browse files
authored
Merge pull request #93 from guokr/sanic
Sanic
2 parents dda7006 + 8d19e8f commit fdfac96

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

swagger_py_codegen/templates/sanic/validators.tpl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,13 @@ def request_validate(view):
140140
def response_filter(view):
141141

142142
@wraps(view)
143-
def wrapper(*args, **kwargs):
143+
async def wrapper(*args, **kwargs):
144144
request = args[1]
145145
resp = view(*args, **kwargs)
146146

147+
from inspect import isawaitable
148+
if isawaitable(resp):
149+
resp = await resp
147150
if isinstance(resp, HTTPResponse):
148151
return resp
149152

@@ -185,4 +188,4 @@ def response_filter(view):
185188
headers=headers,
186189
)
187190

188-
return wrapper
191+
return wrapper

0 commit comments

Comments
 (0)