alexfremont commited on
Commit
7e31555
·
1 Parent(s): f73ccd7

try fixing valid key issue

Browse files
Files changed (1) hide show
  1. main.py +1 -1
main.py CHANGED
@@ -23,7 +23,7 @@ VALID_API_KEYS = os.environ.get("api_key")
23
  @app.middleware("http")
24
  async def verify_api_key(request, call_next):
25
  api_key = request.headers.get("x-api-key")
26
- if api_key not in VALID_API_KEYS:
27
  raise HTTPException(status_code=403, detail="Unauthorized")
28
  response = await call_next(request)
29
  return response
 
23
  @app.middleware("http")
24
  async def verify_api_key(request, call_next):
25
  api_key = request.headers.get("x-api-key")
26
+ if api_key is None or api_key not in VALID_API_KEYS:
27
  raise HTTPException(status_code=403, detail="Unauthorized")
28
  response = await call_next(request)
29
  return response