Skip to content

Commit

Permalink
Merge pull request #1558 from iwamot/testafter
Browse files Browse the repository at this point in the history
Add test for 'func (*Response) After'
  • Loading branch information
lammel authored Jul 20, 2020
2 parents 165648d + 4aebe68 commit 7533c69
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7533c69

Please sign in to comment.