chore: use http.Status* instead of hard code (#1482)

This commit is contained in:
田欧
2018-08-14 09:51:56 +08:00
committed by Bo-Yi Wu
parent 8aef947f6e
commit f45c928a15
20 changed files with 209 additions and 192 deletions

View File

@ -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")
}