staticcheck/sa1008/testdata/go1.0/CheckCanonicalHeaderKey/CheckCanonicalHeaderKey.go
raw| 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 | } |