mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-01 21:24:23 +08:00
Merge pull request #275 from mem/master
Add tests for websocket configuration
This commit is contained in:
commit
3614a093e3
|
@ -54,6 +54,25 @@ func TestWebSocketParse(t *testing.T) {
|
||||||
Path: "/api4",
|
Path: "/api4",
|
||||||
Command: "cat",
|
Command: "cat",
|
||||||
}}},
|
}}},
|
||||||
|
|
||||||
|
{`websocket /api5 "cmd arg1 arg2 arg3"`, false, []websocket.Config{{
|
||||||
|
Path: "/api5",
|
||||||
|
Command: "cmd",
|
||||||
|
Arguments: []string{"arg1", "arg2", "arg3"},
|
||||||
|
}}},
|
||||||
|
|
||||||
|
// accept respawn
|
||||||
|
{`websocket /api6 cat {
|
||||||
|
respawn
|
||||||
|
}`, false, []websocket.Config{{
|
||||||
|
Path: "/api6",
|
||||||
|
Command: "cat",
|
||||||
|
}}},
|
||||||
|
|
||||||
|
// invalid configuration
|
||||||
|
{`websocket /api7 cat {
|
||||||
|
invalid
|
||||||
|
}`, true, []websocket.Config{}},
|
||||||
}
|
}
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
c := NewTestController(test.inputWebSocketConfig)
|
c := NewTestController(test.inputWebSocketConfig)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user