Skip to content

Commit

Permalink
update method name maching color ~matching with Postman method color
Browse files Browse the repository at this point in the history
  • Loading branch information
zerolethanh committed Nov 16, 2022
1 parent e83b22f commit 5b60688
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
Expand Down
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
}
Expand Down

0 comments on commit 5b60688

Please sign in to comment.