mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-27 09:18:09 +00:00
HTTP middleware create issues when streaming project archive
This commit is contained in:
parent
940d22f2aa
commit
015e17338c
@ -166,12 +166,14 @@ async def sqlalchemry_error_handler(request: Request, exc: SQLAlchemyError):
|
|||||||
content={"message": "Database error detected, please check logs to find details"},
|
content={"message": "Database error detected, please check logs to find details"},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# FIXME: do not use this middleware since it creates issue when using StreamingResponse
|
||||||
|
# see https://starlette-context.readthedocs.io/en/latest/middleware.html#why-are-there-two-middlewares-that-do-the-same-thing
|
||||||
|
|
||||||
@app.middleware("http")
|
# @app.middleware("http")
|
||||||
async def add_extra_headers(request: Request, call_next):
|
# async def add_extra_headers(request: Request, call_next):
|
||||||
start_time = time.time()
|
# start_time = time.time()
|
||||||
response = await call_next(request)
|
# response = await call_next(request)
|
||||||
process_time = time.time() - start_time
|
# process_time = time.time() - start_time
|
||||||
response.headers["X-Process-Time"] = str(process_time)
|
# response.headers["X-Process-Time"] = str(process_time)
|
||||||
response.headers["X-GNS3-Server-Version"] = f"{__version__}"
|
# response.headers["X-GNS3-Server-Version"] = f"{__version__}"
|
||||||
return response
|
# return response
|
||||||
|
Loading…
Reference in New Issue
Block a user