From 7abd56bd1fb780f6bda47f533fa497662f7c2a90 Mon Sep 17 00:00:00 2001 From: fancg <451922429@qq.com> Date: Sun, 5 May 2019 22:05:15 +0800 Subject: [PATCH] add Forward support --- context.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/context.go b/context.go index 5dc7f8a0..e5321dbf 100644 --- a/context.go +++ b/context.go @@ -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. func (c *Context) Data(code int, contentType string, data []byte) { c.Render(code, render.Data{