Added ReplacePathRegex middleware
This commit is contained in:
parent
e8633d17e8
commit
5042c5bf40
5 changed files with 138 additions and 0 deletions
|
@ -92,6 +92,13 @@ func (r *Rules) replacePath(paths ...string) *mux.Route {
|
|||
return r.route.route
|
||||
}
|
||||
|
||||
func (r *Rules) replacePathRegex(paths ...string) *mux.Route {
|
||||
for _, path := range paths {
|
||||
r.route.replacePathRegex = path
|
||||
}
|
||||
return r.route.route
|
||||
}
|
||||
|
||||
func (r *Rules) addPrefix(paths ...string) *mux.Route {
|
||||
for _, path := range paths {
|
||||
r.route.addPrefix = path
|
||||
|
@ -155,6 +162,7 @@ func (r *Rules) parseRules(expression string, onRule func(functionName string, f
|
|||
"HeadersRegexp": r.headersRegexp,
|
||||
"AddPrefix": r.addPrefix,
|
||||
"ReplacePath": r.replacePath,
|
||||
"ReplacePathRegex": r.replacePathRegex,
|
||||
"Query": r.query,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue