diff --git a/internal/internal.go b/internal/internal.go index e31ea240f..4f2737e63 100644 --- a/internal/internal.go +++ b/internal/internal.go @@ -384,13 +384,13 @@ func (p *envoyExtAuthzGrpcServer) check(ctx context.Context, req interface{}) (* return nil } - if ctx.Err() != nil { - err = errors.Wrap(ctx.Err(), "check request timed out before query execution") + input, err = envoyauth.RequestToInput(req, logger, p.cfg.protoSet, p.cfg.SkipRequestBodyParse) + if err != nil { return nil, stop, err } - input, err = envoyauth.RequestToInput(req, logger, p.cfg.protoSet, p.cfg.SkipRequestBodyParse) - if err != nil { + if ctx.Err() != nil { + err = errors.Wrap(ctx.Err(), "check request timed out before query execution") return nil, stop, err } diff --git a/internal/internal_test.go b/internal/internal_test.go index 342748819..f02e1e786 100644 --- a/internal/internal_test.go +++ b/internal/internal_test.go @@ -520,6 +520,10 @@ func TestCheckContextTimeout(t *testing.T) { if event.Error.Error() != expectedErrMsg { t.Fatalf("Expected error message %v but got %v", expectedErrMsg, event.Error.Error()) } + + if len((*event.Input).(map[string]interface{})) == 0 { + t.Fatalf("Expected non empty input but got %v", *event.Input) + } } func TestCheckIllegalDecisionWithLogger(t *testing.T) {