fixed linting iessues

This commit is contained in:
MohitKatare-protean
2025-04-04 14:59:40 +05:30
parent 593b76427c
commit 49e460f61d
2 changed files with 1 additions and 16 deletions

View File

@@ -17,8 +17,6 @@ type Config struct {
Role string Role string
} }
type keyType string
const contextKey = "context" const contextKey = "context"
func NewPreProcessor(cfg *Config) (func(http.Handler) http.Handler, error) { 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 return
} }
// Extract context from request // Extract context from request.
reqContext, ok := req["context"].(map[string]interface{}) reqContext, ok := req["context"].(map[string]interface{})
if !ok { if !ok {
http.Error(w, fmt.Sprintf("%s field not found or invalid.", contextKey), http.StatusBadRequest) http.Error(w, fmt.Sprintf("%s field not found or invalid.", contextKey), http.StatusBadRequest)

View File

@@ -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 // Mock handler to capture processed request context
func captureContextHandler(t *testing.T, expectedSubID string) http.Handler { func captureContextHandler(t *testing.T, expectedSubID string) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {