Send HTTP error code when failing to decode payload

This commit is contained in:
Thorben Günther 2023-09-28 12:59:10 +02:00
parent d2eef546d5
commit 3baffc9bef
No known key found for this signature in database
GPG key ID: 415CD778D8C5AFED

View file

@ -401,6 +401,7 @@ func (br *bridge) handleWebhooks(w http.ResponseWriter, r *http.Request) {
var event payload var event payload
if err := json.NewDecoder(r.Body).Decode(&event); err != nil { if err := json.NewDecoder(r.Body).Decode(&event); err != nil {
http.Error(w, "Failed to parse payload", http.StatusInternalServerError)
logger.Debug("Failed to decode payload", logger.Debug("Failed to decode payload",
slog.String("error", err.Error())) slog.String("error", err.Error()))
return return