INNER CODE UNIT · Python

add_process_time_header

anthonycorletti/cloudrun-fastapi · cloudrunfastapi/main.py:22

async def add_process_time_header(request: Request, call_next: Callable) -> Any:
    start_time = time.time()
    response = await call_next(request)
    process_time = time.time() - start_time
    response.headers["X-Process-Time"] = str(process_time)
    return response


#
#   set routers
#
api.include_router(health.router)
api.include_router(auth.router)
api.include_router(user.router)
api.include_router(item.router)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…