Skip to content

Commit 4b14280

Browse files
Asuanodeke-em
authored andcommitted
net/http: add corner cases for readCookiesTests
The following corner cases for readCookiesTests are tested now: - An extra cookie delimiter ";" at the end of a Cookie header - An empty Cookie header Change-Id: Id8028b448e4182613fb261bf0903efc98cbf4997 Reviewed-on: https://go-review.googlesource.com/c/go/+/164702 Reviewed-by: Volker Dobler <[email protected]> Reviewed-by: Emmanuel Odeke <[email protected]> Run-TryBot: Emmanuel Odeke <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent a0c227a commit 4b14280

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/net/http/cookie_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,19 @@ var readCookiesTests = []struct {
385385
{Name: "c2", Value: "v2"},
386386
},
387387
},
388+
{
389+
Header{"Cookie": {`Cookie-1="v$1"; c2=v2;`}},
390+
"",
391+
[]*Cookie{
392+
{Name: "Cookie-1", Value: "v$1"},
393+
{Name: "c2", Value: "v2"},
394+
},
395+
},
396+
{
397+
Header{"Cookie": {``}},
398+
"",
399+
[]*Cookie{},
400+
},
388401
}
389402

390403
func TestReadCookies(t *testing.T) {

0 commit comments

Comments
 (0)