1
0
mirror of https://github.com/labstack/echo.git synced 2025-12-01 22:51:17 +02:00

Inline feature (#637)

This commit is contained in:
Francisco Guimarães
2016-08-22 18:46:21 -03:00
committed by Vishal Rana
parent 6fd725c953
commit 8a85626a71
2 changed files with 27 additions and 1 deletions

View File

@@ -145,6 +145,19 @@ func TestContext(t *testing.T) {
}
}
// Inline
rec = test.NewResponseRecorder()
c = e.NewContext(req, rec).(*echoContext)
file, err = os.Open("_fixture/images/walle.png")
if assert.NoError(t, err) {
err = c.Inline(file, "walle.png")
if assert.NoError(t, err) {
assert.Equal(t, http.StatusOK, rec.Status())
assert.Equal(t, "inline; filename=walle.png", rec.Header().Get(HeaderContentDisposition))
assert.Equal(t, 219885, rec.Body.Len())
}
}
// NoContent
rec = test.NewResponseRecorder()
c = e.NewContext(req, rec).(*echoContext)