From: codesoap Date: Thu, 8 Feb 2024 22:18:27 +0000 (+0000) Subject: net/http: remove superfluous newline on redirects X-Git-Tag: go1.23rc1~1248 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2b58355ef624239dbe32185dc8dfc9d1074615c6;p=gostls13.git net/http: remove superfluous newline on redirects Change-Id: I30d3ae9d540f9cc85ea5a6875ee8884d3e646d6f GitHub-Last-Rev: 29cabdcb3a8746ef51953617f4ec47deac3608da GitHub-Pull-Request: golang/go#65623 Reviewed-on: https://go-review.googlesource.com/c/go/+/562356 Reviewed-by: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov Auto-Submit: Dmitri Shuralyov Reviewed-by: Than McIntosh TryBot-Bypass: Dmitri Shuralyov --- diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go index 2185869414..f633bf0799 100644 --- a/src/net/http/serve_test.go +++ b/src/net/http/serve_test.go @@ -2659,7 +2659,7 @@ func TestRedirectContentTypeAndBody(t *testing.T) { wantCT string wantBody string }{ - {MethodGet, nil, "text/html; charset=utf-8", "Found.\n\n"}, + {MethodGet, nil, "text/html; charset=utf-8", "Found.\n"}, {MethodHead, nil, "text/html; charset=utf-8", ""}, {MethodPost, nil, "", ""}, {MethodDelete, nil, "", ""}, diff --git a/src/net/http/server.go b/src/net/http/server.go index acac78bcd0..d42fdc6322 100644 --- a/src/net/http/server.go +++ b/src/net/http/server.go @@ -2273,7 +2273,7 @@ func Redirect(w ResponseWriter, r *Request, url string, code int) { // Shouldn't send the body for POST or HEAD; that leaves GET. if !hadCT && r.Method == "GET" { - body := "" + StatusText(code) + ".\n" + body := "" + StatusText(code) + "." fmt.Fprintln(w, body) } }