Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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(
|
35 |
-
return
|
36 |
-
|
37 |
-
|
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")
|