diff --git a/pkg/plugin/implementation/reqpreprocessor/reqpreprocessor.go b/pkg/plugin/implementation/reqpreprocessor/reqpreprocessor.go index 554a9b5..441a3a7 100644 --- a/pkg/plugin/implementation/reqpreprocessor/reqpreprocessor.go +++ b/pkg/plugin/implementation/reqpreprocessor/reqpreprocessor.go @@ -17,8 +17,6 @@ type Config struct { Role string } -type keyType string - const contextKey = "context" func NewPreProcessor(cfg *Config) (func(http.Handler) http.Handler, error) { @@ -39,7 +37,7 @@ func NewPreProcessor(cfg *Config) (func(http.Handler) http.Handler, error) { return } - // Extract context from request + // Extract context from request. reqContext, ok := req["context"].(map[string]interface{}) if !ok { http.Error(w, fmt.Sprintf("%s field not found or invalid.", contextKey), http.StatusBadRequest) diff --git a/pkg/plugin/implementation/reqpreprocessor/reqpreprocessor_test.go b/pkg/plugin/implementation/reqpreprocessor/reqpreprocessor_test.go index 8f34759..20beb18 100644 --- a/pkg/plugin/implementation/reqpreprocessor/reqpreprocessor_test.go +++ b/pkg/plugin/implementation/reqpreprocessor/reqpreprocessor_test.go @@ -233,19 +233,6 @@ func TestNewPreProcessorErrorCases(t *testing.T) { } } -// Mock configuration -var testConfig = &Config{ - Role: "bap", -} - -// Mock request payload -var testPayload = `{ - "context": { - "message_id": "test-msg-id", - "bap_id": "test-bap-id" - } -}` - // Mock handler to capture processed request context func captureContextHandler(t *testing.T, expectedSubID string) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {