From 6e8762f962c5eaaee1c92e910c95c8b85b7c1e11 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 10 Mar 2024 09:32:48 +0800 Subject: [PATCH] Fix broken webhooks (#29690) Fix #29689 --- services/webhook/payloader.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/webhook/payloader.go b/services/webhook/payloader.go index abf9946cca4..54a11a58682 100644 --- a/services/webhook/payloader.go +++ b/services/webhook/payloader.go @@ -94,7 +94,12 @@ func newJSONRequest[T any](pc payloadConvertor[T], w *webhook_model.Webhook, t * return nil, nil, err } - req, err := http.NewRequest(w.HTTPMethod, w.URL, bytes.NewReader(body)) + method := w.HTTPMethod + if method == "" { + method = http.MethodPost + } + + req, err := http.NewRequest(method, w.URL, bytes.NewReader(body)) if err != nil { return nil, nil, err }