1
0
mirror of https://github.com/golang/go synced 2024-11-26 20:01:19 -07:00

net/http: remove superfluous newline on redirects

This commit is contained in:
codesoap 2023-12-23 14:17:03 +01:00
parent 2184a39477
commit 29cabdcb3a
2 changed files with 2 additions and 2 deletions

View 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, "", ""},

View 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)
}
}