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 <appleboy.tw@gmail.com>
This commit is contained in:
Miles 2020-05-24 11:37:32 +08:00 committed by GitHub
parent 9221381443
commit 5f261fa752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -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. Issuing a Router redirect, use `HandleContext` like below.