Standard library / net/http
http.Header
Map canonical HTTP field names to ordered lists of values. Use methods for canonicalization. Expected stdout: '[a b]\n'.
Formal Syntax & Structure
go syntaxgo
type Header map[string][]stringWorking Example
Example Snippetgo
package main
import ( "fmt" "net/http")
func main() { h := http.Header{} h.Add("X-Demo", "a") h.Add("X-Demo", "b") fmt.Println(h.Values("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) }}