Skip to content

Commit

Permalink
rule: Allow regex in match scheme
Browse files Browse the repository at this point in the history
Closes #92

Signed-off-by: arekkas <[email protected]>
  • Loading branch information
arekkas committed Aug 1, 2018
1 parent f8d16a7 commit a917597
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rule/rule_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ func ValidateRule(
methods := []string{"GET", "POST", "PUT", "HEAD", "DELETE", "PATCH", "OPTIONS", "TRACE", "CONNECT"}

return func(r *Rule) error {
if !govalidator.IsURL(r.Match.URL) {
return errors.WithStack(helper.ErrBadRequest.WithReason(fmt.Sprintf("Value \"%s\" from match.url field is not a valid url.", r.Match.URL)))
}
// This is disabled because it doesn't support checking for regular expressions (obviously).
// if !govalidator.IsURL(r.Match.URL) {
// return errors.WithStack(helper.ErrBadRequest.WithReason(fmt.Sprintf("Value \"%s\" from match.url field is not a valid url.", r.Match.URL)))
// }

for _, m := range r.Match.Methods {
if !stringslice.Has(methods, m) {
Expand Down

0 comments on commit a917597

Please sign in to comment.