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

SetURLPrefix有什么用? #174

Closed
zarte opened this issue Apr 2, 2019 · 1 comment
Closed

SetURLPrefix有什么用? #174

zarte opened this issue Apr 2, 2019 · 1 comment

Comments

@zarte
Copy link

zarte commented Apr 2, 2019

代码如下:

m.SetURLPrefix("api")
m.Group("/v1", func() {
		m.Get("/test", func() string  {
			return "test"
		})
	})

访问/api/v1/test跟/v1/test一样的,需要的是/v1/test不能访问到。
还有在test里获取到的ctx.Req.URL.Path无论是/api..还是/v1..都是/v1/test没有/api这一层

@unknwon
Copy link
Contributor

unknwon commented Apr 9, 2019

就是 trim prefix .. 一般情况下没什么用。。就是对 api/v1/v1 一视同仁。

@unknwon unknwon closed this as completed Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants