Skip to content

Commit 7a8a72d

Browse files
DorKatzelnickHagarMeir
authored andcommitted
change request verifier to return request type
Signed-off-by: Dor.Katzelnick <[email protected]>
1 parent 2d16191 commit 7a8a72d

File tree

15 files changed

+425
-96
lines changed

15 files changed

+425
-96
lines changed

common/requestfilter/mocks/filter_config.go

Lines changed: 16 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/requestfilter/mocks/rule.go

Lines changed: 8 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/requestfilter/mocks/structureRule.go

Lines changed: 187 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/requestfilter/rule.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ type Rule interface {
1717
Update(config FilterConfig) error
1818
}
1919

20+
//go:generate counterfeiter -o ./mocks/structureRule.go . StructureRule
21+
type StructureRule interface {
22+
Verify(request *comm.Request) (string, error)
23+
Update(config FilterConfig) error
24+
}
25+
2026
// FilterConfig is an interface that gives the necessary information to verify rules.
2127
//
2228
//go:generate counterfeiter -o ./mocks/filter_config.go . FilterConfig

common/requestfilter/rule_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ func TestAcceptFilter(t *testing.T) {
1818
var v requestfilter.RulesVerifier
1919
v.AddRule(requestfilter.AcceptRule{})
2020
request := &comm.Request{Payload: nil}
21-
err := v.Verify(request)
21+
_, err := v.Verify(request)
2222
require.NoError(t, err)
2323
}

0 commit comments

Comments
 (0)