From 99738dd9a77780e36323c30b5ed6a2409fe74691 Mon Sep 17 00:00:00 2001 From: bddjr Date: Wed, 19 Jun 2024 23:01:09 +0800 Subject: [PATCH] Optimize Response.Write --- response.go | 1 + 1 file changed, 1 insertion(+) diff --git a/response.go b/response.go index 10c289b..76c2d79 100644 --- a/response.go +++ b/response.go @@ -50,6 +50,7 @@ func (resp Response) Write(a ...any) error { resp.Body = io.NopCloser(bytes.NewBuffer(b)) resp.ContentLength = int64(len(b)) } else { + resp.Body = nil resp.ContentLength = 0 } return resp.Response.Write(resp.writer)