Some code improvements (#1909)
* strings.ToLower comparison changed to strings.EqualFold. * Rewrite switch statement with only one case as if.
This commit is contained in:
@ -671,7 +671,7 @@ func (c *Context) ContentType() string {
|
||||
// handshake is being initiated by the client.
|
||||
func (c *Context) IsWebsocket() bool {
|
||||
if strings.Contains(strings.ToLower(c.requestHeader("Connection")), "upgrade") &&
|
||||
strings.ToLower(c.requestHeader("Upgrade")) == "websocket" {
|
||||
strings.EqualFold(c.requestHeader("Upgrade"), "websocket") {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
Reference in New Issue
Block a user