1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00

Merge pull request #1558 from iwamot/testafter

Add test for 'func (*Response) After'
This commit is contained in:
Roland Lammel 2020-07-20 18:00:17 +02:00 committed by GitHub
commit 7533c6984b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,8 +19,13 @@ func TestResponse(t *testing.T) {
res.Before(func() {
c.Response().Header().Set(HeaderServer, "echo")
})
// After
res.After(func() {
c.Response().Header().Set(HeaderXFrameOptions, "DENY")
})
res.Write([]byte("test"))
assert.Equal(t, "echo", rec.Header().Get(HeaderServer))
assert.Equal(t, "DENY", rec.Header().Get(HeaderXFrameOptions))
}
func TestResponse_Write_FallsBackToDefaultStatus(t *testing.T) {