kenken999 commited on
Commit
07a2401
·
1 Parent(s): 0f45d56
Files changed (1) hide show
  1. routers/webhook.py +4 -4
routers/webhook.py CHANGED
@@ -234,11 +234,11 @@ async def webhook(request: Request):
234
  # }
235
  #r#esponse = requests.post(os.getenv("WEBHOOK_URL"), headers=headers, data=body)
236
 
237
- #if not line_signature:
238
- # raise HTTPException(status_code=400, detail="X-Line-Signature header is missing.")
239
 
240
- #if not validate_signature(body.decode("utf-8"), line_signature, os.getenv("ChannelSecret")):
241
- # raise HTTPException(status_code=400, detail="Invalid signature.")
242
 
243
  if not os.getenv("WEBHOOK_URL") or not os.getenv("WEBHOOK_URL").startswith("https://"):
244
  raise HTTPException(status_code=400, detail="Invalid webhook URL")
 
234
  # }
235
  #r#esponse = requests.post(os.getenv("WEBHOOK_URL"), headers=headers, data=body)
236
 
237
+ if not line_signature:
238
+ raise HTTPException(status_code=400, detail="X-Line-Signature header is missing.")
239
 
240
+ if not validate_signature(body.decode("utf-8"), line_signature, os.getenv("ChannelSecret")):
241
+ raise HTTPException(status_code=400, detail="Invalid signature.")
242
 
243
  if not os.getenv("WEBHOOK_URL") or not os.getenv("WEBHOOK_URL").startswith("https://"):
244
  raise HTTPException(status_code=400, detail="Invalid webhook URL")