Standard library / net/textproto
textproto.MIMEHeader.Values()
Return the underlying slice of all values for the canonicalized key, not a copy. Expected stdout: 'b\n'.
Formal Syntax & Structure
go syntaxgo
func (h MIMEHeader) Values(key string) []stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| key | string | MIME header field name. |
Return Value
[]string
Underlying value slice, not a copy.
Working Example
Example Snippetgo
package main
import ( "fmt" "net/textproto")
func main() { h := textproto.MIMEHeader{} h.Add("X-Demo", "a") v := h.Values("x-demo") v[0] = "b" fmt.Println(h.Get("X-Demo"))}
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}