]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "net/http: remove superfluous newline on redirects"
authorRuss Cox <rsc@golang.org>
Thu, 14 Mar 2024 13:55:01 +0000 (13:55 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 14 Mar 2024 14:18:44 +0000 (14:18 +0000)
This reverts commit 2b58355ef624239dbe32185dc8dfc9d1074615c6.

Reason for revert: This breaks tons of tests for no real reason.

Change-Id: I89773f48cf983c0b6346e46c37a0ebbe2620e3b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/571675
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

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

index 9df6ab426ce80d4bdb2d924c7b90513fed980314..1012e44b688fa694ae5938417dd5e61766cc34d2 100644 (file)
@@ -2712,7 +2712,7 @@ func TestRedirectContentTypeAndBody(t *testing.T) {
                wantCT   string
                wantBody string
        }{
-               {MethodGet, nil, "text/html; charset=utf-8", "<a href=\"/foo\">Found</a>.\n"},
+               {MethodGet, nil, "text/html; charset=utf-8", "<a href=\"/foo\">Found</a>.\n\n"},
                {MethodHead, nil, "text/html; charset=utf-8", ""},
                {MethodPost, nil, "", ""},
                {MethodDelete, nil, "", ""},
index d0e4dc69e5b53e512d9c470d00e7dc5fd748b0d7..99c6d4fd0a09c54c96d6a623482069487a53dfea 100644 (file)
@@ -2287,7 +2287,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>."
+               body := "<a href=\"" + htmlEscape(url) + "\">" + StatusText(code) + "</a>.\n"
                fmt.Fprintln(w, body)
        }
 }