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

restful uri conflicts with existing wildcard #1990

Closed
layxyer opened this issue Jul 15, 2019 · 2 comments · Fixed by #2663
Closed

restful uri conflicts with existing wildcard #1990

layxyer opened this issue Jul 15, 2019 · 2 comments · Fixed by #2663

Comments

@layxyer
Copy link

layxyer commented Jul 15, 2019

Here's sample code:

func RegisterDemoRoute(r *Engine) {
	v1 := r.Group("api/v1/sys")
	{
		v1.GET("users/:id", service.GetSysUser)
		// conflicts with existing wildcard for "v1.GET("users/:id", service.GetSysUser)"
		v1.GET("users/:id/roles", service.GetSysUserRolePageList)
	}
}

"users/:id" and "users/roles" are conflicts,but Java web can do this,What should I do under gin?

@layxyer layxyer closed this as completed Jul 15, 2019
@layxyer layxyer reopened this Jul 16, 2019
@layxyer
Copy link
Author

layxyer commented Jul 16, 2019

I verified that springmvc can use "/users/{id}" and "/users/roles" and "/users/1122" to give priority to uri matching. The parameters in matching uri will also check the type. Can gin be done?

@thinkerou
Copy link
Member

please see #388

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