Skip to content

Commit

Permalink
expose x-consumer-id header in cors
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Oct 12, 2023
1 parent f1f48d2 commit 17568fe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions emmet-api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

logging.getLogger("uvicorn.access").handlers = []
from asgi_logger import AccessLoggerMiddleware
from fastapi.middleware.cors import CORSMiddleware

from material_resources import resources as materials_resources
from molecule_resources import resources as molecule_resources
Expand All @@ -29,5 +30,9 @@
AccessLoggerMiddleware,
format='%(h)s %(t)s %(m)s %(U)s?%(q)s %(H)s %(s)s %(b)s "%(f)s" "%(a)s" %(D)s %(p)s %({x-consumer-id}i)s',
)
app.add_middleware(
CORSMiddleware,
expose_headers=["x-consumer-id"]
)
delta = time.perf_counter() - start
logger.warning(f"Startup took {delta:.1f}s")

0 comments on commit 17568fe

Please sign in to comment.