From 9056137107eea56cba5bd5f3e84e67a62d6079cc Mon Sep 17 00:00:00 2001 From: Miles Date: Sat, 23 May 2020 22:55:26 +0800 Subject: [PATCH 1/2] Add a redirect sample for POST method Refer to issue https://github.com/gin-gonic/gin/issues/444 --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9cc23fc2d6..7f33e1683b 100644 --- a/README.md +++ b/README.md @@ -1393,7 +1393,12 @@ r.GET("/test", func(c *gin.Context) { c.Redirect(http.StatusMovedPermanently, "http://www.google.com/") }) ``` - +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. From a21c6d1efd75a9a9d723f4f538275de938d2d1bf Mon Sep 17 00:00:00 2001 From: Miles Date: Sun, 24 May 2020 10:39:25 +0800 Subject: [PATCH 2/2] put an empty line before 1396 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7f33e1683b..771b577ff1 100644 --- a/README.md +++ b/README.md @@ -1393,6 +1393,7 @@ r.GET("/test", func(c *gin.Context) { c.Redirect(http.StatusMovedPermanently, "http://www.google.com/") }) ``` + 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) {