Merge pull request #33 from channelcat/middleware-unreachable
Middleware unreachable
This commit is contained in:
commit
8e07edb211
|
@ -1,4 +0,0 @@
|
||||||
class Middleware:
|
|
||||||
def __init__(self, process_request=None, process_response=None):
|
|
||||||
self.process_request = process_request
|
|
||||||
self.process_response = process_response
|
|
|
@ -1,12 +1,10 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
from inspect import isawaitable
|
from inspect import isawaitable
|
||||||
from traceback import format_exc
|
from traceback import format_exc
|
||||||
from types import FunctionType
|
|
||||||
|
|
||||||
from .config import Config
|
from .config import Config
|
||||||
from .exceptions import Handler
|
from .exceptions import Handler
|
||||||
from .log import log, logging
|
from .log import log, logging
|
||||||
from .middleware import Middleware
|
|
||||||
from .response import HTTPResponse
|
from .response import HTTPResponse
|
||||||
from .router import Router
|
from .router import Router
|
||||||
from .server import serve
|
from .server import serve
|
||||||
|
@ -80,11 +78,6 @@ class Sanic:
|
||||||
attach_to = args[0]
|
attach_to = args[0]
|
||||||
return register_middleware
|
return register_middleware
|
||||||
|
|
||||||
if isinstance(middleware, FunctionType):
|
|
||||||
middleware = Middleware(process_request=middleware)
|
|
||||||
|
|
||||||
return middleware
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------- #
|
# -------------------------------------------------------------------- #
|
||||||
# Request Handling
|
# Request Handling
|
||||||
# -------------------------------------------------------------------- #
|
# -------------------------------------------------------------------- #
|
||||||
|
|
Loading…
Reference in New Issue
Block a user