mirror of
https://github.com/caddyserver/caddy.git
synced 2026-07-01 06:11:35 +00:00
Add tests for websocket configuration
Command arguments:
websocket /api5 "cmd arg1 arg2 arg3"
Optional block:
websocket /api6 cat {
respawn
}
Invalid option in optional block:
websocket /api7 cat {
invalid
}
This commit is contained in:
parent
3faffdce2d
commit
6325bcf5b2
1 changed files with 19 additions and 0 deletions
|
|
@ -54,6 +54,25 @@ func TestWebSocketParse(t *testing.T) {
|
|||
Path: "/api4",
|
||||
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 {
|
||||
c := NewTestController(test.inputWebSocketConfig)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue