Skip to content

Commit

Permalink
FIX: silenece linting no attribute msg for Middleware.
Browse files Browse the repository at this point in the history
  • Loading branch information
milo-hyben committed Jan 12, 2024
1 parent 12e40d1 commit 011a548
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ async def exception_handler(request: Request, e: Exception):
cors_middleware = middlewares[0]

request_origin = request.headers.get('origin', '')
if cors_middleware and '*' in cors_middleware.options['allow_origins']:
if cors_middleware and '*' in cors_middleware.options['allow_origins']: # type: ignore[attr-defined]
response.headers['Access-Control-Allow-Origin'] = '*'
elif (
cors_middleware
and request_origin in cors_middleware.options['allow_origins']
and request_origin in cors_middleware.options['allow_origins'] # type: ignore[attr-defined]
):
response.headers['Access-Control-Allow-Origin'] = request_origin

Expand Down

0 comments on commit 011a548

Please sign in to comment.