1
0
mirror of https://github.com/labstack/echo.git synced 2025-06-21 00:29:32 +02:00

Closes #525, closes #566, closes #573 (#653)

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2016-09-09 15:30:07 -07:00
parent 00699ed0db
commit 03efe4d61b
2 changed files with 39 additions and 6 deletions

View File

@ -132,6 +132,17 @@ func TestContext(t *testing.T) {
assert.Equal(t, "Hello, <strong>World!</strong>", rec.Body.String())
}
// Stream
rec = test.NewResponseRecorder()
c = e.NewContext(req, rec).(*echoContext)
r := strings.NewReader("response from a stream")
err = c.Stream(http.StatusOK, "application/octet-stream", r)
if assert.NoError(t, err) {
assert.Equal(t, http.StatusOK, rec.Status())
assert.Equal(t, "application/octet-stream", rec.Header().Get(HeaderContentType))
assert.Equal(t, "response from a stream", rec.Body.String())
}
// Attachment
rec = test.NewResponseRecorder()
c = e.NewContext(req, rec).(*echoContext)