diff --git a/echo.go b/echo.go index 4b0c785a..d284ff39 100644 --- a/echo.go +++ b/echo.go @@ -500,7 +500,6 @@ func (common) static(prefix, root string, get func(string, HandlerFunc, ...Middl } return c.File(name) } - get(prefix, h) if prefix == "/" { return get(prefix+"*", h) } diff --git a/echo_test.go b/echo_test.go index 895ea182..a6071e12 100644 --- a/echo_test.go +++ b/echo_test.go @@ -102,15 +102,6 @@ func TestEchoStatic(t *testing.T) { expectHeaderLocation: "/folder/", expectBodyStartsWith: "", }, - { - name: "Directory Redirect with non-root path", - givenPrefix: "/static", - givenRoot: "_fixture", - whenURL: "/static", - expectStatus: http.StatusMovedPermanently, - expectHeaderLocation: "/static/", - expectBodyStartsWith: "", - }, { name: "Directory with index.html", givenPrefix: "/", @@ -170,40 +161,6 @@ func TestEchoStatic(t *testing.T) { } } -func TestEchoStaticRedirectIndex(t *testing.T) { - assert := assert.New(t) - e := New() - - // HandlerFunc - e.Static("/static", "_fixture") - - errCh := make(chan error) - - go func() { - errCh <- e.Start("127.0.0.1:1323") - }() - - time.Sleep(200 * time.Millisecond) - - if resp, err := http.Get("http://127.0.0.1:1323/static"); err == nil { - defer resp.Body.Close() - assert.Equal(http.StatusOK, resp.StatusCode) - - if body, err := ioutil.ReadAll(resp.Body); err == nil { - assert.Equal(true, strings.HasPrefix(string(body), "")) - } else { - assert.Fail(err.Error()) - } - - } else { - assert.Fail(err.Error()) - } - - if err := e.Close(); err != nil { - t.Fatal(err) - } -} - func TestEchoFile(t *testing.T) { e := New() e.File("/walle", "_fixture/images/walle.png")