diff --git a/echo_test.go b/echo_test.go index 09495d1c..8e5b3d9e 100644 --- a/echo_test.go +++ b/echo_test.go @@ -78,8 +78,14 @@ func TestEchoStatic(t *testing.T) { // Directory with index.html e.Static("/", "examples/website/public") - c, _ = request(GET, "/", e) + c, r := request(GET, "/", e) assert.Equal(t, http.StatusOK, c) + assert.Equal(t, true, strings.HasPrefix(r, "")) + + // Sub-directory with index.html + c, r = request(GET, "/folder", e) + assert.Equal(t, http.StatusOK, c) + assert.Equal(t, "sub directory", r) } func TestEchoMiddleware(t *testing.T) { diff --git a/examples/website/public/folder/index.html b/examples/website/public/folder/index.html new file mode 100644 index 00000000..36b3a421 --- /dev/null +++ b/examples/website/public/folder/index.html @@ -0,0 +1 @@ +sub directory \ No newline at end of file