]> Cypherpunks repositories - gostls13.git/commitdiff
http: improve Get documentation
authorminherz <minherz@gmail.com>
Mon, 13 Jun 2022 05:26:02 +0000 (22:26 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 18 Jul 2022 15:58:37 +0000 (15:58 +0000)
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>
src/net/http/header.go

index 6437f2d2c07529a35a2268fc0ef7fde404835d5b..e0b342c63cbd94046f83915786844aaf7f1def53 100644 (file)
@@ -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)