FastAPI - Middleware and Hooks
Identify the error in this middleware code:
```python
class TimingMiddleware(BaseHTTPMiddleware):
async def dispatch(self, request, call_next):
start = time.time()
response = call_next(request)
duration = time.time() - start
response.headers["X-Process-Time"] = str(duration)
return response
```
