all: use strings.EqualFold for string comparison (#24890)

This commit is contained in:
Håvard Anda Estensen
2022-05-17 13:56:52 +02:00
committed by GitHub
parent e0a9752b96
commit e644d45c14
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -357,7 +357,7 @@ func (h *httpServer) wsAllowed() bool {
// isWebsocket checks the header of an http request for a websocket upgrade request.
func isWebsocket(r *http.Request) bool {
return strings.ToLower(r.Header.Get("Upgrade")) == "websocket" &&
return strings.EqualFold(r.Header.Get("Upgrade"), "websocket") &&
strings.Contains(strings.ToLower(r.Header.Get("Connection")), "upgrade")
}
+1 -1
View File
@@ -283,7 +283,7 @@ func rpcRequest(t *testing.T, url string, extraHeaders ...string) *http.Response
}
for i := 0; i < len(extraHeaders); i += 2 {
key, value := extraHeaders[i], extraHeaders[i+1]
if strings.ToLower(key) == "host" {
if strings.EqualFold(key, "host") {
req.Host = value
} else {
req.Header.Set(key, value)