mirror of
https://github.com/golang/go
synced 2024-11-17 13:54:46 -07:00
net/http: useless string replace operation in Cookie.String. Fixes #29135
This commit is contained in:
parent
4e8aaf6b22
commit
1209770405
@ -169,7 +169,7 @@ func (c *Cookie) String() string {
|
||||
return ""
|
||||
}
|
||||
var b strings.Builder
|
||||
b.WriteString(sanitizeCookieName(c.Name))
|
||||
b.WriteString(c.Name)
|
||||
b.WriteRune('=')
|
||||
b.WriteString(sanitizeCookieValue(c.Value))
|
||||
|
||||
|
@ -127,6 +127,14 @@ var writeSetCookiesTests = []struct {
|
||||
&Cookie{Name: "\t"},
|
||||
``,
|
||||
},
|
||||
{
|
||||
&Cookie{Name: "\r"},
|
||||
``,
|
||||
},
|
||||
{
|
||||
&Cookie{Name: "\n"},
|
||||
``,
|
||||
},
|
||||
}
|
||||
|
||||
func TestWriteSetCookies(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user