MCPcopy
hub / github.com/gorilla/websocket / returnError

Method returnError

server.go:77–86  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request, status int, reason string)

Source from the content-addressed store, hash-verified

75}
76
77func (u *Upgrader) returnError(w http.ResponseWriter, r *http.Request, status int, reason string) (*Conn, error) {
78 err := HandshakeError{reason}
79 if u.Error != nil {
80 u.Error(w, r, status, err)
81 } else {
82 w.Header().Set("Sec-Websocket-Version", "13")
83 http.Error(w, http.StatusText(status), status)
84 }
85 return nil, err
86}
87
88// checkSameOrigin returns true if the origin is not set or is equal to the request host.
89func checkSameOrigin(r *http.Request) bool {

Callers 1

UpgradeMethod · 0.95

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected