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

🤗 How to get path param before a custom verb? #1931

Closed
GotaX opened this issue Jun 9, 2022 · 6 comments · Fixed by #1983
Closed

🤗 How to get path param before a custom verb? #1931

GotaX opened this issue Jun 9, 2022 · 6 comments · Fixed by #1983

Comments

@GotaX
Copy link

GotaX commented Jun 9, 2022

Question description

The http request is GET http://localhost:3000/resources/123:verb

How to get 123 from request path? I tried \\:customVerb as the document said but c.Params("id") return nothing.

Version

v2.34.0

Code snippet

package main

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

func main() {
	app := fiber.New()
	app.Get("/resources/:id\\:verb", func(c *fiber.Ctx) error {
		return c.SendString(c.Params("id"))
	})
	_ = app.Listen(":3000")
}
@welcome
Copy link

welcome bot commented Jun 9, 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

@suttapak
Copy link

suttapak commented Jun 9, 2022

Can you change verb to query string?
Sorry if is wrong,i am new githuber ;-)

@GotaX
Copy link
Author

GotaX commented Jun 9, 2022

@suttapak Thank you for reply. Our API follow the Google API Design, so it's not easy to replace custom verb with query string.

@ReneWerner87
Copy link
Member

Will check it more closely at the weekend

Think the problem is that the end of the parameter name can not be determined by our logic

@ReneWerner87
Copy link
Member

sorry had no time until now, will look at it in the next few days

@GotaX
Copy link
Author

GotaX commented Jun 15, 2022

@ReneWerner87 No problem. I'm not in a hurry.

ReneWerner87 added a commit that referenced this issue Jul 26, 2022
FIX for "🤗 How to get path param before a custom verb? #1931"
ReneWerner87 added a commit that referenced this issue Jul 27, 2022
* Add possibility for parameters before custom verb
FIX for "🤗 How to get path param before a custom verb? #1931"

* try to stabilize the tests
trim21 pushed a commit to trim21/fiber that referenced this issue Aug 15, 2022
…ofiber#1983)

* Add possibility for parameters before custom verb
FIX for "🤗 How to get path param before a custom verb? gofiber#1931"

* try to stabilize the tests
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.

3 participants