@app.middleware("http")
async def add_process_time_header(request: Request, call_next):
print('处理请求前,运行中间件============')
response = await call_next(request)
print('处理请求后,运行中间件============')
return response
@app.middleware("http")
async def add_process_time_header(request: Request, call_next):
print('处理请求前,运行中间件============')
response = await call_next(request)
print('处理请求后,运行中间件============')
return response