feat(Go-StudyExample): 2020/12/9 :新增Gin框架使用示例

This commit is contained in:
Huangzj
2020-12-09 09:45:46 +08:00
parent 9ad10e8cd9
commit 1361db0274
22 changed files with 881 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
/*
* @Author : huangzj
* @Time : 2020/12/8 16:22
* @Description
*/
package gin
import (
"github.com/gin-gonic/gin"
"testing"
)
//重定向
func TestRedirect(t *testing.T) {
r := gin.Default()
r.GET("/test", func(c *gin.Context) {
c.Request.URL.Path = "/test2"
r.HandleContext(c)
})
r.GET("/test2", func(c *gin.Context) {
c.JSON(200, gin.H{"hello": "world"})
})
}