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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 [Bug]: Multiple constraints does not work in routes #2076

Closed
3 tasks done
OK93-01-18 opened this issue Sep 7, 2022 · 2 comments 路 Fixed by #2077
Closed
3 tasks done

馃悰 [Bug]: Multiple constraints does not work in routes #2076

OK93-01-18 opened this issue Sep 7, 2022 · 2 comments 路 Fixed by #2077
Assignees

Comments

@OK93-01-18
Copy link

Bug Description

I found bug with constraints in routes.

How to Reproduce

I was trying add route like that:

app.Get("/:lang<len(2)>/videos/:page<range(1,1000)>/", func(c *fiber.Ctx) error {
    fmt.Println(c.Params("lang") + "_" + c.Params("page"))
    return nil
})

Expected Behavior

When i sent:
GET /es/videos/22/
i received:
Cannot GET /es/videos/22/
But should get:
es_22

Fiber Version

v2.37.0

Code Snippet (optional)

package main

import (
	"fmt"
	"github.com/gofiber/fiber/v2"
)

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

	app.Get("/:lang<len(2)>/videos/:page<range(1,1000)>/", func(c *fiber.Ctx) error {
		fmt.Println(c.Params("lang") + "_" + c.Params("page"))
		return nil
	})

	app.Listen(":3000")
}

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my problem prior to opening this one.
  • I understand that improperly formatted bug reports may be closed without explanation.
@welcome
Copy link

welcome bot commented Sep 7, 2022

Thanks for opening your first issue here! 馃帀 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@efectn efectn self-assigned this Sep 7, 2022
@efectn
Copy link
Member

efectn commented Sep 7, 2022

Thanks for the feedback. Will check it today or tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants