def __init__(self, url, service_impl_cls):
self.url = url_endswith_slash(url)
self.scheme, self.host, self.path, _, _ = urllib.parse.urlsplit(
self.url
)
def null_app(environ, start_response):
start_response('404 Not Found', [('Content-Type', 'text/plain')])
return ['Not Found']
wsgi_app = WsgiApp(service_impl_cls())
if self.path != '/':
self.wsgi_app = DispatcherMiddleware(
null_app, {self.path[:-1]: wsgi_app}
)
else:
self.wsgi_app = wsgi_app
self.wsgi_test_client = Client(self.wsgi_app, Response)
评论列表
文章目录