Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix: route naming when to use group in group. #1736

Merged
merged 1 commit into from Jan 29, 2022

Conversation

efectn
Copy link
Member

@efectn efectn commented Jan 29, 2022

If we use group in group, name of first group won't appear.

Code:

func main() {
	app := fiber.New()

	a := app.Group("/a").Name("a.")

	b := a.Group("/b").Name("b.")
	b.Get("/hello/", func(c *fiber.Ctx) error {
		return c.SendString("d")
	}).Name("c")

	data, _ := json.MarshalIndent(app.Stack(), "", "  ")
	fmt.Print(string(data))
}

Old Output:

[
  [
    {
      "method": "GET",
      "name": "b.c",
      "path": "/a/b/hello/",
      "params": null
    }
  ],
  [
    {
      "method": "HEAD",
      "name": "",
      "path": "/a/b/hello/",
      "params": null
    }
  ],
  ...
]

New Output:

[
  [
    {
      "method": "GET",
      "name": "a.b.c",
      "path": "/a/b/hello/",
      "params": null
    }
  ],
  [
    {
      "method": "HEAD",
      "name": "",
      "path": "/a/b/hello/",
      "params": null
    }
  ],
  ...
]

@ReneWerner87 ReneWerner87 merged commit d3c2122 into gofiber:master Jan 29, 2022
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants