2020-09-08 19:45:48 +03:00
|
|
|
package integration
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/caddyserver/caddy/v2/caddytest"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestBrowse(t *testing.T) {
|
|
|
|
tester := caddytest.NewTester(t)
|
|
|
|
tester.InitServer(`
|
|
|
|
{
|
2022-09-24 22:00:55 +03:00
|
|
|
skip_install_trust
|
|
|
|
admin localhost:2999
|
2020-09-08 19:45:48 +03:00
|
|
|
http_port 9080
|
|
|
|
https_port 9443
|
2022-09-24 22:00:55 +03:00
|
|
|
grace_period 1ns
|
2020-09-08 19:45:48 +03:00
|
|
|
}
|
|
|
|
http://localhost:9080 {
|
|
|
|
file_server browse
|
|
|
|
}
|
|
|
|
`, "caddyfile")
|
|
|
|
|
|
|
|
req, err := http.NewRequest(http.MethodGet, "http://localhost:9080/", nil)
|
|
|
|
if err != nil {
|
|
|
|
t.Fail()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
tester.AssertResponseCode(req, 200)
|
|
|
|
}
|