]> Cypherpunks repositories - gostls13.git/commit
net/http: add Cookie.Valid method
authorJohn Kelly <jkelly@squarespace.com>
Thu, 29 Jul 2021 19:47:23 +0000 (15:47 -0400)
committerIan Lance Taylor <iant@golang.org>
Wed, 6 Oct 2021 23:26:57 +0000 (23:26 +0000)
commitc8dd89ed3dde52933d981d7d7c4c200160f47ec3
treefc8759b37552fd6a61f7c3c299528d36ea9c2f87
parentf3758443424dd6e411e2ac0108efdefd2ad7b294
net/http: add Cookie.Valid method

The (*http.Cookie).String method used by SetCookie will silently discard
or sanitize any fields it deems invalid, making it difficult to tell
whether a cookie will be sent as expected.

This change introduces a new (*http.Cookie).Valid method which may be
used to check if any cookie fields will be discarded or sanitized prior
to calling (*http.Cookie).String.

Fixes #46370

Change-Id: I2db80078de190d267a9c675a9717c8be8acc8704
Reviewed-on: https://go-review.googlesource.com/c/go/+/338590
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Cherry Mui <cherryyz@google.com>
Trust: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
api/next.txt
src/net/http/cookie.go
src/net/http/cookie_test.go