1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 22:01:29 +00:00

better comment for color map

This commit is contained in:
JessonChan 2019-03-08 12:10:57 +08:00
parent 4a5e108527
commit 8432a1c758

View File

@ -161,10 +161,12 @@ func initColor() {
cyan = w32Cyan cyan = w32Cyan
} }
colorMap = map[string]string{ colorMap = map[string]string{
//by color
"green": green, "green": green,
"white": white, "white": white,
"yellow": yellow, "yellow": yellow,
"red": red, "red": red,
//by method
"GET": blue, "GET": blue,
"POST": cyan, "POST": cyan,
"PUT": yellow, "PUT": yellow,
@ -195,13 +197,6 @@ func ColorByStatus(code int) string {
} }
// ColorByMethod return color by http code // ColorByMethod return color by http code
// GET return Blue
// POST return Cyan
// PUT return Yellow
// DELETE return Red
// PATCH return Green
// HEAD return Magenta
// OPTIONS return WHITE
func ColorByMethod(method string) string { func ColorByMethod(method string) string {
once.Do(initColor) once.Do(initColor)
if c := colorMap[method]; c != "" { if c := colorMap[method]; c != "" {