This commit is contained in:
yumoqing 2024-08-07 11:39:28 +08:00
parent 9c04b7c50e
commit f596df7696

View File

@ -18,7 +18,7 @@ class FunctionProcessor(BaseProcessor):
async def path_call(self, request, path): async def path_call(self, request, path):
path1 = request.path[len(self.config_opts['leading']):] path1 = request.path[len(self.config_opts['leading']):]
args = [request] args = []
if len(path1) > 0: if len(path1) > 0:
if path1[0] == '/': if path1[0] == '/':
path1 = path1[1:] path1 = path1[1:]
@ -35,8 +35,8 @@ class FunctionProcessor(BaseProcessor):
self.run_ns['request'] = request self.run_ns['request'] = request
globals().update(self.run_ns) globals().update(self.run_ns)
if inspect.iscoroutinefunction(f): if inspect.iscoroutinefunction(f):
return await f(*args, **self.run_ns) return await f(request, self.run_ns, *args)
return f(*args, **self.run_ns) return f(request, self.run_ns, *args)
async def datahandle(self,request): async def datahandle(self,request):
x = await self.path_call(request, self.path) x = await self.path_call(request, self.path)