Skip to content

Commit

Permalink
fix validation of expected file
Browse files Browse the repository at this point in the history
  • Loading branch information
avrahams committed Nov 14, 2022
1 parent 8237770 commit 87e26b8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ var WithRequestNumber = func(reqNum int) RequestHandlerOption {
//WithUpdateExpected option sets the update expected flag for the handler
var WithTestRequest = func(t *testing.T, updateExpected bool, expectedRequest []byte, expectedRequestFile string) RequestHandlerOption {
return func(o *requestHandlerOptions) error {
if expectedRequest == nil || expectedRequestFile == "" || t == nil {
return fmt.Errorf("test, expected request and expected request file must be provided")
if expectedRequest == nil || t == nil {
return fmt.Errorf("test, expected request must be provided")
}
if updateExpected && expectedRequestFile == "" {
return fmt.Errorf("expectedRequestFile must be provided when update expected is true")

}
o.t = t
o.updateExpected = updateExpected
Expand Down

0 comments on commit 87e26b8

Please sign in to comment.