mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-24 10:01:04 +01:00
refactor: move api/v1/utils to net/gphttp
This commit is contained in:
21
internal/net/gphttp/httpheaders/websocket.go
Normal file
21
internal/net/gphttp/httpheaders/websocket.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package httpheaders
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
const (
|
||||
HeaderXGoDoxyWebsocketAllowedDomains = "X-GoDoxy-Websocket-Allowed-Domains"
|
||||
)
|
||||
|
||||
func WebsocketAllowedDomains(h http.Header) []string {
|
||||
return h[HeaderXGoDoxyWebsocketAllowedDomains]
|
||||
}
|
||||
|
||||
func SetWebsocketAllowedDomains(h http.Header, domains []string) {
|
||||
h[HeaderXGoDoxyWebsocketAllowedDomains] = domains
|
||||
}
|
||||
|
||||
func IsWebsocket(h http.Header) bool {
|
||||
return UpgradeType(h) == "websocket"
|
||||
}
|
||||
Reference in New Issue
Block a user