mirror of
https://github.com/labstack/echo.git
synced 2025-06-21 00:29:32 +02:00
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user