aboutsummaryrefslogtreecommitdiff
path: root/src/net/http
diff options
context:
space:
mode:
authorminherz <minherz@gmail.com>2022-06-12 22:26:02 -0700
committerGopher Robot <gobot@golang.org>2022-07-18 15:58:37 +0000
commitc0c1bbde172c33e6e4ea994b413f23ca42c50c06 (patch)
tree885d14422af5d32e794418234eb93d86fe382a64 /src/net/http
parent2aa473cc54128c1498f80263763a2a876308e565 (diff)
downloadgo-c0c1bbde172c33e6e4ea994b413f23ca42c50c06.tar.xz
http: improve Get documentation
The existing documentation is unclear about header keys formatting. The clarifying sentence is added to Get function to emphasis that keys have to be stored in canonical format to have Get returining non empty value. Fixes #53140 Change-Id: Icd0955bcbb6676cec028fe37042aed5846e13ed1 Reviewed-on: https://go-review.googlesource.com/c/go/+/417975 Run-TryBot: Damien Neil <dneil@google.com> Auto-Submit: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/net/http')
-rw-r--r--src/net/http/header.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net/http/header.go b/src/net/http/header.go
index 6437f2d2c0..e0b342c63c 100644
--- a/src/net/http/header.go
+++ b/src/net/http/header.go
@@ -43,7 +43,8 @@ func (h Header) Set(key, value string) {
// Get gets the first value associated with the given key. If
// there are no values associated with the key, Get returns "".
// It is case insensitive; textproto.CanonicalMIMEHeaderKey is
-// used to canonicalize the provided key. To use non-canonical keys,
+// used to canonicalize the provided key. Get assumes that all
+// keys are stored in canonical form. To use non-canonical keys,
// access the map directly.
func (h Header) Get(key string) string {
return textproto.MIMEHeader(h).Get(key)