github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/staticcheck/sa1008/testdata/src/example.com/CheckCanonicalHeaderKey/CheckCanonicalHeaderKey.go (about)

     1  package pkg
     2  
     3  import "net/http"
     4  
     5  func fn() {
     6  	const hdr = "foo"
     7  	var r http.Request
     8  	h := http.Header{}
     9  	var m map[string][]string
    10  	_ = h["foo"] //@ diag(`keys in http.Header are canonicalized`)
    11  	_ = h[hdr]   //@ diag(`keys in http.Header are canonicalized`)
    12  	h["foo"] = nil
    13  	_ = r.Header["foo"] //@ diag(`keys in http.Header are canonicalized`)
    14  	r.Header["foo"] = nil
    15  	_ = m["foo"]
    16  }