add Forward support

This commit is contained in:
fancg 2019-05-05 22:05:15 +08:00
parent 202f8fc58a
commit 7abd56bd1f

View File

@ -858,6 +858,13 @@ func (c *Context) Redirect(code int, location string) {
}) })
} }
// Forward re-enter a context that has been rewritten.
// This can be done by setting c.Request.URL.Path to your new target.
// Disclaimer: You can loop yourself to death with this, use wisely.
func (c *Context) Forward() {
c.engine.HandleContext(c)
}
// Data writes some data into the body stream and updates the HTTP code. // Data writes some data into the body stream and updates the HTTP code.
func (c *Context) Data(code int, contentType string, data []byte) { func (c *Context) Data(code int, contentType string, data []byte) {
c.Render(code, render.Data{ c.Render(code, render.Data{