mirror of https://github.com/tiangolo/fastapi.git
Add annotations
This commit is contained in:
parent
8c572a9ef2
commit
44df0185d0
|
|
@ -4515,6 +4515,7 @@ class FastAPI(Starlette):
|
|||
|
||||
```python
|
||||
import time
|
||||
from typing import Awaitable, Callabe
|
||||
|
||||
from fastapi import FastAPI, Request
|
||||
|
||||
|
|
@ -4522,7 +4523,7 @@ class FastAPI(Starlette):
|
|||
|
||||
|
||||
@app.middleware("http")
|
||||
async def add_process_time_header(request: Request, call_next):
|
||||
async def add_process_time_header(request: Request, call_next: Callable[[Request], Awaitable[Response]):
|
||||
start_time = time.time()
|
||||
response = await call_next(request)
|
||||
process_time = time.time() - start_time
|
||||
|
|
|
|||
Loading…
Reference in New Issue