MCPcopy
hub / github.com/grafana/dskit / IsWSHandshakeRequest

Function IsWSHandshakeRequest

middleware/instrument.go:66–77  ·  view source on GitHub ↗

IsWSHandshakeRequest returns true if the given request is a websocket handshake request.

(req *http.Request)

Source from the content-addressed store, hash-verified

64
65// IsWSHandshakeRequest returns true if the given request is a websocket handshake request.
66func IsWSHandshakeRequest(req *http.Request) bool {
67 if strings.ToLower(req.Header.Get("Upgrade")) == "websocket" {
68 // Connection header values can be of form "foo, bar, ..."
69 parts := strings.Split(strings.ToLower(req.Header.Get("Connection")), ",")
70 for _, part := range parts {
71 if strings.TrimSpace(part) == "upgrade" {
72 return true
73 }
74 }
75 }
76 return false
77}
78
79// Wrap implements middleware.Interface
80func (i Instrument) Wrap(next http.Handler) http.Handler {

Callers 2

WrapMethod · 0.85
WrapMethod · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected