Skip to content

Commit fe24483

Browse files
Added additional test for empty elements
1 parent 5173d94 commit fe24483

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: internal/operators/restpath_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,19 @@ func TestRestPathShouldNotMatchOnIncompleteURLWithEndingParam(t *testing.T) {
125125
t.Errorf("Expected %s to NOT match %s", exp, path)
126126
}
127127
}
128+
129+
func TestRestPathShouldNotMatchOnEmptyPathElement(t *testing.T) {
130+
waf := corazawaf.NewWAF()
131+
tx := waf.NewTransaction()
132+
exp := "/some-random/{id}/{name}"
133+
path := "/some-random//test"
134+
rp, err := newRESTPath(plugintypes.OperatorOptions{
135+
Arguments: exp,
136+
})
137+
if err != nil {
138+
t.Error(err)
139+
}
140+
if rp.Evaluate(tx, path) {
141+
t.Errorf("Expected %s to NOT match %s", exp, path)
142+
}
143+
}

0 commit comments

Comments
 (0)