From c0c1bbde172c33e6e4ea994b413f23ca42c50c06 Mon Sep 17 00:00:00 2001 From: minherz Date: Sun, 12 Jun 2022 22:26:02 -0700 Subject: [PATCH] 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 Auto-Submit: Damien Neil TryBot-Result: Gopher Robot Reviewed-by: Damien Neil --- src/net/http/header.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)