1
0
mirror of https://github.com/golang/go synced 2024-11-17 15:44:40 -07:00

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>
This commit is contained in:
minherz 2022-06-12 22:26:02 -07:00 committed by Gopher Robot
parent 2aa473cc54
commit c0c1bbde17

View 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)