mirror of
https://github.com/gin-gonic/gin.git
synced 2025-05-21 01:17:49 +08:00
chore: use http.Status* instead of hard code (#1482)
This commit is contained in:
@ -54,7 +54,7 @@ func BenchmarkOneRouteJSON(B *testing.B) {
|
||||
Status string `json:"status"`
|
||||
}{"ok"}
|
||||
router.GET("/json", func(c *Context) {
|
||||
c.JSON(200, data)
|
||||
c.JSON(http.StatusOK, data)
|
||||
})
|
||||
runRequest(B, router, "GET", "/json")
|
||||
}
|
||||
@ -66,7 +66,7 @@ func BenchmarkOneRouteHTML(B *testing.B) {
|
||||
router.SetHTMLTemplate(t)
|
||||
|
||||
router.GET("/html", func(c *Context) {
|
||||
c.HTML(200, "index", "hola")
|
||||
c.HTML(http.StatusOK, "index", "hola")
|
||||
})
|
||||
runRequest(B, router, "GET", "/html")
|
||||
}
|
||||
@ -82,7 +82,7 @@ func BenchmarkOneRouteSet(B *testing.B) {
|
||||
func BenchmarkOneRouteString(B *testing.B) {
|
||||
router := New()
|
||||
router.GET("/text", func(c *Context) {
|
||||
c.String(200, "this is a plain text")
|
||||
c.String(http.StatusOK, "this is a plain text")
|
||||
})
|
||||
runRequest(B, router, "GET", "/text")
|
||||
}
|
||||
|
Reference in New Issue
Block a user