]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: remove superfluous newline on redirects
authorcodesoap <codesoap@mailbox.org>
Thu, 8 Feb 2024 22:18:27 +0000 (22:18 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 12 Feb 2024 14:35:18 +0000 (14:35 +0000)
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 <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>

src/net/http/serve_test.go
src/net/http/server.go

index 21858694144ce222ec1d92eec881c2eb27a13613..f633bf07995ca6d1065e25c0accbb8f8505e6506 100644 (file)
@@ -2659,7 +2659,7 @@ func TestRedirectContentTypeAndBody(t *testing.T) {
                wantCT   string
                wantBody string
        }{
-               {MethodGet, nil, "text/html; charset=utf-8", "<a href=\"/foo\">Found</a>.\n\n"},
+               {MethodGet, nil, "text/html; charset=utf-8", "<a href=\"/foo\">Found</a>.\n"},
                {MethodHead, nil, "text/html; charset=utf-8", ""},
                {MethodPost, nil, "", ""},
                {MethodDelete, nil, "", ""},
index acac78bcd0c54b07b50ec9dd99e3e7e58bcb67ef..d42fdc6322574c8f5e94d1218d22d743be67e263 100644 (file)
@@ -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 := "<a href=\"" + htmlEscape(url) + "\">" + StatusText(code) + "</a>.\n"
+               body := "<a href=\"" + htmlEscape(url) + "\">" + StatusText(code) + "</a>."
                fmt.Fprintln(w, body)
        }
 }