mirror of https://github.com/gorilla/websocket.git
Allow cross-origin requests for example
For the sake of testing the websocket server, accepting cross-origin requests is useful - to allow usage of things like http://www.websocket.org/echo.html
This commit is contained in:
parent
527637c0f3
commit
773808209f
|
@ -16,7 +16,11 @@ import (
|
|||
|
||||
var addr = flag.String("addr", "localhost:8081", "http service address")
|
||||
|
||||
var upgrader = websocket.Upgrader{} // use default options
|
||||
var upgrader = websocket.Upgrader{
|
||||
CheckOrigin: func(r *http.Request) bool {
|
||||
return true
|
||||
},
|
||||
} // use default options, except origin. Allows cross-origin requests for testing.
|
||||
|
||||
func echo(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/" {
|
||||
|
|
Loading…
Reference in New Issue