From 975aea88aebae16770522eb0f3d45d1071685634 Mon Sep 17 00:00:00 2001 From: pancho horrillo Date: Mon, 11 May 2020 15:57:25 +0200 Subject: [PATCH] fix: prevent spurious stack trace with misbehaving clients MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/golang/go/commit/9997545a8626bf1a73002f44a7b7538988da4e76 and the previous commit. Co-authored-by: César Gallego Rodríguez --- internal/server/data/resource.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/server/data/resource.go b/internal/server/data/resource.go index 4d76afc..48ce0e8 100644 --- a/internal/server/data/resource.go +++ b/internal/server/data/resource.go @@ -42,9 +42,7 @@ func getRequestBody(w http.ResponseWriter, r *http.Request, h *model.Handler) { if n == 0 { httperror.ErrorJSON(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) } else { - // Only way to abort current connection as of go 1.13 - // https://github.com/golang/go/issues/16542 - panic("Truncated body") + panic(http.ErrAbortHandler) } } }