lint: enable canonicalheader linter (#7330)

Enable canonicalheader linter to enforce proper HTTP header casing.
This ensures headers use Go's canonical format (e.g., "Content-Type"
instead of "content-type") for consistency.

Fixes header casing in DoH implementation.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
Ville Vesilehto
2025-05-29 03:33:07 +03:00
committed by GitHub
parent 0a48523083
commit bebb7bce43
2 changed files with 5 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ version: "2"
linters:
default: none
enable:
- canonicalheader
- copyloopvar
- govet
- ineffassign

View File

@@ -45,8 +45,8 @@ func NewRequest(method, url string, m *dns.Msg) (*http.Request, error) {
return req, err
}
req.Header.Set("content-type", MimeType)
req.Header.Set("accept", MimeType)
req.Header.Set("Content-Type", MimeType)
req.Header.Set("Accept", MimeType)
return req, nil
case http.MethodPost:
@@ -59,8 +59,8 @@ func NewRequest(method, url string, m *dns.Msg) (*http.Request, error) {
return req, err
}
req.Header.Set("content-type", MimeType)
req.Header.Set("accept", MimeType)
req.Header.Set("Content-Type", MimeType)
req.Header.Set("Accept", MimeType)
return req, nil
default: