Fix broken webhooks (#29690)

Fix #29689
This commit is contained in:
Lunny Xiao 2024-03-10 09:32:48 +08:00 committed by GitHub
parent 9bf693d98d
commit 6e8762f962
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -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
}