From 5f261fa7529e62f574831ec7e869a5680ed23b52 Mon Sep 17 00:00:00 2001 From: Miles Date: Sun, 24 May 2020 11:37:32 +0800 Subject: [PATCH] Add a redirect sample for POST method (#2389) * Add a redirect sample for POST method Refer to issue https://github.com/gin-gonic/gin/issues/444 * put an empty line before 1396 Co-authored-by: Bo-Yi Wu --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 9cc23fc2..771b577f 100644 --- a/README.md +++ b/README.md @@ -1394,6 +1394,12 @@ r.GET("/test", func(c *gin.Context) { }) ``` +Issuing a HTTP redirect from POST. Refer to issue: [#444](https://github.com/gin-gonic/gin/issues/444) +```go +r.POST("/test", func(c *gin.Context) { + c.Redirect(http.StatusFound, "/foo") +}) +``` Issuing a Router redirect, use `HandleContext` like below.