1
0
Fork 0

added path replacement rule

This commit is contained in:
ssttevee 2017-04-25 11:13:39 -07:00
parent 5a8215a1e4
commit aa8375e82b
5 changed files with 82 additions and 0 deletions

View file

@ -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 {