Sirawitch commited on
Commit
0dc5c52
·
verified ·
1 Parent(s): a416543

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -13,7 +13,7 @@ app.add_middleware(
13
  CORSMiddleware,
14
  allow_origins=["*"],
15
  allow_credentials=True,
16
- allow_methods=["*"],
17
  allow_headers=["*"],
18
  )
19
 
@@ -31,11 +31,12 @@ async def root():
31
  return {"message": "Welcome to the API"}
32
 
33
  @app.options("/webhook")
34
- async def webhook_options(request: Request):
35
- return JSONResponse(
36
- status_code=200,
37
- content={"message": "OK"}
38
- )
 
39
 
40
  # Webhook route
41
  @app.post("/webhook")
 
13
  CORSMiddleware,
14
  allow_origins=["*"],
15
  allow_credentials=True,
16
+ allow_methods=["*"], # หรือระบุเจาะจง ["GET", "POST", "OPTIONS"]
17
  allow_headers=["*"],
18
  )
19
 
 
31
  return {"message": "Welcome to the API"}
32
 
33
  @app.options("/webhook")
34
+ async def webhook_options():
35
+ return {"message": "OK"}
36
+
37
+ @app.get("/test")
38
+ async def test():
39
+ return {"message": "Test successful"}
40
 
41
  # Webhook route
42
  @app.post("/webhook")