From 5f7930ce35acae64ba909d05627fb7cfac0eb9cb Mon Sep 17 00:00:00 2001 From: xuans Date: Sun, 30 Aug 2026 20:12:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E6=95=9B=20JSON=20=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E6=B5=8B=E8=AF=95=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/internal/httpapi/json_test.go | 2 -- backend/internal/httpapi/middleware.go | 7 ------- 2 files changed, 9 deletions(-) diff --git a/backend/internal/httpapi/json_test.go b/backend/internal/httpapi/json_test.go index 04f0663..7587a0c 100644 --- a/backend/internal/httpapi/json_test.go +++ b/backend/internal/httpapi/json_test.go @@ -11,8 +11,6 @@ import ( ) func TestBindJSONRejectsUnknownFieldsAndTrailingValues(t *testing.T) { - t.Parallel() - tests := []struct { name string body string diff --git a/backend/internal/httpapi/middleware.go b/backend/internal/httpapi/middleware.go index 6d2e28c..569decf 100644 --- a/backend/internal/httpapi/middleware.go +++ b/backend/internal/httpapi/middleware.go @@ -93,13 +93,6 @@ func (s *Server) sameOriginForAPI(request *http.Request) bool { return strings.EqualFold(parsed.Host, request.Host) && strings.EqualFold(parsed.Scheme, requestScheme) } -func limitJSONBody(c *gin.Context) { - if c == nil || c.Request == nil || c.Request.Body == nil { - return - } - c.Request.Body = http.MaxBytesReader(c.Writer, c.Request.Body, jsonRequestBodyLimit) -} - func requestIDFromContext(c *gin.Context) string { value, exists := c.Get("request_id") if !exists {