mikmc5 commited on
Commit
a3099ac
·
verified ·
1 Parent(s): c20eaa0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -10,14 +10,12 @@ load_dotenv()
10
 
11
  app_ = FastAPI()
12
 
13
- # Initialize Jinja2Templates for HTML rendering
14
  templates = Jinja2Templates(directory="templates")
15
 
16
- # Function to add CORS headers
17
  def add_cors_headers(response: Response):
18
- response.headers['Access-Control-Allow-Origin'] = '*' # Allow all domains
19
- response.headers['Access-Control-Allow-Methods'] = 'GET, POST, OPTIONS' # Allowed methods
20
- response.headers['Access-Control-Allow-Headers'] = 'Content-Type' # Allowed headers
21
  return response
22
 
23
  MANIFEST = {
@@ -92,9 +90,9 @@ async def proxy_logo(request: Request):
92
  content_type = response.headers.get('Content-Type', 'image/jpeg')
93
 
94
  resp = Response(content=response.content, media_type=content_type)
95
- resp.headers['Access-Control-Allow-Origin'] = '*' # Allow any origin
96
- resp.headers['Access-Control-Allow-Methods'] = 'GET, OPTIONS' # Allowed methods
97
- resp.headers['Access-Control-Allow-Headers'] = 'Content-Type' # Allowed headers
98
 
99
  return resp
100
 
 
10
 
11
  app_ = FastAPI()
12
 
 
13
  templates = Jinja2Templates(directory="templates")
14
 
 
15
  def add_cors_headers(response: Response):
16
+ response.headers['Access-Control-Allow-Origin'] = '*'
17
+ response.headers['Access-Control-Allow-Methods'] = 'GET, POST, OPTIONS'
18
+ response.headers['Access-Control-Allow-Headers'] = 'Content-Type'
19
  return response
20
 
21
  MANIFEST = {
 
90
  content_type = response.headers.get('Content-Type', 'image/jpeg')
91
 
92
  resp = Response(content=response.content, media_type=content_type)
93
+ resp.headers['Access-Control-Allow-Origin'] = '*'
94
+ resp.headers['Access-Control-Allow-Methods'] = 'GET, OPTIONS'
95
+ resp.headers['Access-Control-Allow-Headers'] = 'Content-Type'
96
 
97
  return resp
98