~xenrox/ntfy-alertmanager

3baffc9befcc0f68a40dc8659c0d779925256c5f — Thorben Günther 6 months ago d2eef54
Send HTTP error code when failing to decode payload
1 files changed, 1 insertions(+), 0 deletions(-)

M main.go
M main.go => main.go +1 -0
@@ 401,6 401,7 @@ func (br *bridge) handleWebhooks(w http.ResponseWriter, r *http.Request) {

	var event payload
	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",
			slog.String("error", err.Error()))
		return