Merge PR #1705: baseapp: Allow alphanumerics in routes
Previously only alphabetic characters were allowed.
This commit is contained in:
committed by
Christopher Goes
parent
d6969c1d22
commit
f88d64499d
@@ -290,7 +290,7 @@ func (tx txTest) GetMsgs() []sdk.Msg { return tx.Msgs }
|
||||
|
||||
const (
|
||||
typeMsgCounter = "msgCounter"
|
||||
typeMsgCounter2 = "msgCounterTwo" // NOTE: no numerics (?)
|
||||
typeMsgCounter2 = "msgCounter2"
|
||||
)
|
||||
|
||||
// ValidateBasic() fails on negative counters.
|
||||
|
||||
+3
-3
@@ -31,12 +31,12 @@ func NewRouter() *router {
|
||||
}
|
||||
}
|
||||
|
||||
var isAlpha = regexp.MustCompile(`^[a-zA-Z]+$`).MatchString
|
||||
var isAlphaNumeric = regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString
|
||||
|
||||
// AddRoute - TODO add description
|
||||
func (rtr *router) AddRoute(r string, h sdk.Handler) Router {
|
||||
if !isAlpha(r) {
|
||||
panic("route expressions can only contain alphabet characters")
|
||||
if !isAlphaNumeric(r) {
|
||||
panic("route expressions can only contain alphanumeric characters")
|
||||
}
|
||||
rtr.routes = append(rtr.routes, route{r, h})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user