You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// For client requests, certain headers such as Content-Length
// and Connection are automatically written when needed and
// values in Header may be ignored. See the documentation
// for the Request.Write method.
dominikh
changed the title
Warn when "Content-Type" or "Connection" is added to http.Request.Header
staticcheck: warn when "Content-Length" or "Connection" is added to http.Request.Header
Apr 29, 2020
https://golang.org/pkg/net/http/#Request.Header
Instead of setting
Content-Length
orConnection
directly in the headers,Request.ContentLength
andRequest.Close
should be used instead.Match statements like:
Since headers are canonicalized, a case insensitive match of the header name would be ideal.
Matching entries when the header map is manually constructed would also be nice, but I imagine would be more involved.
The text was updated successfully, but these errors were encountered: