-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add URLPathTemplate to Route … #104
Add URLPathTemplate to Route … #104
Conversation
… that lists all routes by template
I'm going to close this one out as I don't think it's a useful addition to the public API, but I'm happy to be convinced otherwise if others have a need for it. |
@@ -508,6 508,19 @@ func (r *Route) URLPath(pairs ...string) (*url.URL, error) { | |||
}, nil | |||
} | |||
|
|||
// URLPathTemplate returns the template used to match against for the route |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you expand on this? What is this useful for?
If you can address my comment and add tests I'll re-consider. Really big on having tests for this since mux sees a lot of PRs. |
Updated comments, and added a new testTemplate method that is called everywhere testRoute is called. |
@@ -532,6 532,30 @@ func (r *Route) URLPath(pairs ...string) (*url.URL, error) { | |||
}, nil | |||
} | |||
|
|||
// GetPathTemplate and GetHostTemplate returns the template used to match against for the route |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// GetPathTemplate returns the template used to build the
// route match.
All updated based on latest feedback |
[feature] GetHostTemplate and GetPathTemplate return the template used to build the route.
Merged. Thanks! On Sat, Mar 5, 2016 at 3:28 AM Dj Gilcrease [email protected]
|
to make it easier to generate a API page that lists all routes by template
This works well with #83 so you can do something like