added path replacement rule
This commit is contained in:
parent
5a8215a1e4
commit
aa8375e82b
5 changed files with 82 additions and 0 deletions
|
@ -75,6 +75,13 @@ func (r *Rules) pathStrip(paths ...string) *mux.Route {
|
|||
return r.route.route
|
||||
}
|
||||
|
||||
func (r *Rules) replacePath(paths ...string) *mux.Route {
|
||||
for _, path := range paths {
|
||||
r.route.replacePath = path
|
||||
}
|
||||
return r.route.route
|
||||
}
|
||||
|
||||
func (r *Rules) addPrefix(paths ...string) *mux.Route {
|
||||
for _, path := range paths {
|
||||
r.route.addPrefix = path
|
||||
|
@ -116,6 +123,7 @@ func (r *Rules) parseRules(expression string, onRule func(functionName string, f
|
|||
"Headers": r.headers,
|
||||
"HeadersRegexp": r.headersRegexp,
|
||||
"AddPrefix": r.addPrefix,
|
||||
"ReplacePath": r.replacePath,
|
||||
}
|
||||
|
||||
if len(expression) == 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue