Fixed coroutine checking
This commit is contained in:
parent
af2cf771d4
commit
7ec5432f64
|
@ -5,7 +5,7 @@ import signal
|
||||||
import functools
|
import functools
|
||||||
import httptools
|
import httptools
|
||||||
import logging
|
import logging
|
||||||
from inspect import iscoroutine
|
from inspect import isawaitable
|
||||||
from ujson import loads as json_loads
|
from ujson import loads as json_loads
|
||||||
from urllib.parse import parse_qs
|
from urllib.parse import parse_qs
|
||||||
from traceback import format_exc
|
from traceback import format_exc
|
||||||
|
@ -151,7 +151,7 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
response = handler(request)
|
response = handler(request)
|
||||||
|
|
||||||
# Check if the handler is asynchronous
|
# Check if the handler is asynchronous
|
||||||
if iscoroutine(response):
|
if isawaitable(response):
|
||||||
response = await response
|
response = await response
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user