mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
22 lines
439 B
Go
22 lines
439 B
Go
package websocket
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
)
|
|
|
|
func TestBuildEnv(t *testing.T) {
|
|
req, err := http.NewRequest("GET", "http://localhost", nil)
|
|
if err != nil {
|
|
t.Fatal("Error setting up request:", err)
|
|
}
|
|
req.RemoteAddr = "localhost:50302"
|
|
|
|
env, err := buildEnv("/bin/command", req)
|
|
if err != nil {
|
|
t.Fatal("Didn't expect an error:", err)
|
|
}
|
|
if len(env) == 0 {
|
|
t.Fatalf("Expected non-empty environment; got %#v", env)
|
|
}
|
|
}
|