mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 11:39:17 +00:00
22 lines
373 B
Go
22 lines
373 B
Go
|
package databag
|
||
|
|
||
|
import (
|
||
|
"net/url"
|
||
|
"net/http"
|
||
|
"net/http/httptest"
|
||
|
)
|
||
|
|
||
|
type StatusHandler struct {}
|
||
|
|
||
|
func (h *StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||
|
Status(w, r)
|
||
|
}
|
||
|
|
||
|
func StartTestWebsocketServer() string {
|
||
|
h := StatusHandler{}
|
||
|
s := httptest.NewServer(&h)
|
||
|
wsUrl, _ := url.Parse(s.URL)
|
||
|
wsUrl.Scheme = "ws"
|
||
|
return wsUrl.String()
|
||
|
}
|