From 5b606886099e252f9aed9ece9a39245444e3d14d Mon Sep 17 00:00:00 2001 From: LE VAN THANH Date: Wed, 16 Nov 2022 14:20:02 +0700 Subject: [PATCH] update method name maching color ~matching with Postman method color --- examples/main.go | 3 +++ main.go | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/main.go b/examples/main.go index ef32c10..ba10e6d 100644 --- a/examples/main.go +++ b/examples/main.go @@ -14,6 +14,9 @@ func main() { app.Post("/login", func(c *fiber.Ctx) error { return c.SendString("Login") }) + app.Put("/login/:uid", func(c *fiber.Ctx) error { + return c.SendString("Login") + }) app.Get("/user/:id", func(c *fiber.Ctx) error { return c.SendString("User") }) diff --git a/main.go b/main.go index 9620bfd..47f6150 100644 --- a/main.go +++ b/main.go @@ -75,8 +75,12 @@ func printByPathStacks(stacks []*fiber.Route) { c = color.HiCyanString case "GET": c = color.HiYellowString - case "POST", "PUT", "PATCH": + case "POST": c = color.HiGreenString + case "PUT": + c = color.HiBlueString + case "PATCH": + c = color.HiCyanString case "DELETE": c = color.HiRedString default: @@ -91,7 +95,7 @@ func printByPathStacks(stacks []*fiber.Route) { func getRouteParams(route *fiber.Route) string { var params string if len(route.Params) > 0 { - params = fmt.Sprintf("Params: %v", route.Params) + params = fmt.Sprintf("params:%v", route.Params) } return params }