1
0
mirror of https://github.com/labstack/echo.git synced 2025-11-29 22:48:07 +02:00

Context#StaticContent signature changed

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2016-03-27 21:03:35 -07:00
parent a2d757eddc
commit 28ec39daaa
3 changed files with 23 additions and 25 deletions

View File

@@ -245,23 +245,23 @@ func TestContextServeContent(t *testing.T) {
rc := test.NewResponseRecorder()
c := NewContext(rq, rc, e)
// Not cached
fs := http.Dir("_fixture/images")
f, err := fs.Open("walle.png")
if assert.NoError(t, err) {
if assert.NoError(t, c.ServeContent(f)) {
assert.Equal(t, http.StatusOK, rc.Status())
}
}
fi, err := f.Stat()
if assert.NoError(t, err) {
// Not cached
if assert.NoError(t, c.ServeContent(f, fi.Name(), fi.ModTime())) {
assert.Equal(t, http.StatusOK, rc.Status())
}
// Cached
rc = test.NewResponseRecorder()
c = NewContext(rq, rc, e)
fi, err := f.Stat()
if assert.NoError(t, err) {
rq.Header().Set(IfModifiedSince, fi.ModTime().UTC().Format(http.TimeFormat))
if assert.NoError(t, c.ServeContent(f)) {
assert.Equal(t, http.StatusNotModified, rc.Status())
// Cached
rc = test.NewResponseRecorder()
c = NewContext(rq, rc, e)
rq.Header().Set(IfModifiedSince, fi.ModTime().UTC().Format(http.TimeFormat))
if assert.NoError(t, c.ServeContent(f, fi.Name(), fi.ModTime())) {
assert.Equal(t, http.StatusNotModified, rc.Status())
}
}
}
}