chore: validate param type of application/json when call a webhook (#25074)

This commit is contained in:
非法操作
2025-09-03 15:49:07 +08:00
committed by GitHub
parent 7120c6414c
commit 2013ceb9d2
4 changed files with 363 additions and 40 deletions

View File

@@ -1,7 +1,7 @@
import logging
from flask import jsonify
from werkzeug.exceptions import BadRequest, NotFound
from werkzeug.exceptions import NotFound
from controllers.trigger import bp
from services.webhook_service import WebhookService
@@ -28,7 +28,7 @@ def handle_webhook(webhook_id: str):
# Validate request against node configuration
validation_result = WebhookService.validate_webhook_request(webhook_data, node_config)
if not validation_result["valid"]:
raise BadRequest(validation_result["error"])
return jsonify({"error": "Bad Request", "message": validation_result["error"]}), 400
# Process webhook call (send to Celery)
WebhookService.trigger_workflow_execution(webhook_trigger, webhook_data, workflow)