Added Redirect function
This commit is contained in:
@ -55,3 +55,15 @@ func TestErrorMultiple(t *testing.T) {
|
||||
assert.Equal(t, response.Status(), 401)
|
||||
assert.Equal(t, string(response.Body()), "")
|
||||
}
|
||||
|
||||
func TestRedirect(t *testing.T) {
|
||||
s := web.NewServer()
|
||||
|
||||
s.Get("/", func(ctx web.Context) error {
|
||||
return ctx.Redirect(301, "/target")
|
||||
})
|
||||
|
||||
response := s.Request("GET", "/", nil, nil)
|
||||
assert.Equal(t, response.Status(), 301)
|
||||
assert.Equal(t, response.Header("Location"), "/target")
|
||||
}
|
||||
|
Reference in New Issue
Block a user