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:
@@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user