In order to get multiple values from a header, we have to use a standard map expression. However, we need to be aware that keys are canonicalized (header["My-Key"]) otherwise header["my-key"] will not return any value. Or need to use textproto.CanonicalMIMEHeaderKey() explicitly.
header.Get(key) allows to get the first value and internally uses textproto.CanonicalMIMEHeaderKey to canonicalize the key before getting the value.
Is there a reason not to provide, something likeheader.GetValues(key), which returns []string?
In order to get multiple values from a header, we have to use a standard map expression. However, we need to be aware that keys are canonicalized (
header["My-Key"]) otherwiseheader["my-key"]will not return any value. Or need to usetextproto.CanonicalMIMEHeaderKey()explicitly.header.Get(key)allows to get the first value and internally usestextproto.CanonicalMIMEHeaderKeyto canonicalize the key before getting the value.Is there a reason not to provide, something like
header.GetValues(key), which returns[]string?