Do0rMaMu commited on
Commit
afaddb4
1 Parent(s): 3f2e2d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -15,6 +15,14 @@ app.add_middleware(
15
  allow_headers=["*"],
16
  )
17
 
 
 
 
 
 
 
 
 
18
  class Box:
19
  def __init__(self, length, width, height, quantity, box_type):
20
  self.length = length
 
15
  allow_headers=["*"],
16
  )
17
 
18
+ @app.options("/{rest_of_path:path}")
19
+ async def preflight_handler(request: Request, rest_of_path: str) -> Response:
20
+ return Response(headers={
21
+ "Access-Control-Allow-Origin": "*", # Allows all origins
22
+ "Access-Control-Allow-Methods": "POST, GET, OPTIONS, PUT, DELETE", # Specify methods allowed
23
+ "Access-Control-Allow-Headers": "*", # Allows all headers
24
+ })
25
+
26
  class Box:
27
  def __init__(self, length, width, height, quantity, box_type):
28
  self.length = length