// unmarshalHeaderValue checks if the value is a JSON array value and, if so, unmarshals it and returns an array.
// Otherwise the given string value is returned.
unmarshalHeaderValue checks if the value is a JSON array value and, if so, unmarshals it and returns an array.
Otherwise the given string value is returned.
// unmarshalHeaderValue checks if the value is a JSON array value and if so unmarshals it and returns an array . // Otherwise the given string value is returned .
func unmarshalHeaderValue(value string) (interface{}, error) {
	var arrayValue []interface{}
	err := json.Unmarshal([]byte(value), &arrayValue)
	if err != nil {
		return value, nil 
	}
	headerValue := make([]interface{}, len(arrayValue))
	for i, value := range arrayValue {
		tableValue, ok := value.(amqp.Table)
		if ok {
			headerValue[i] = tableValue
		} else {
			mapValue, ok := value.(map[string]interface{})
			if !ok {
				return nil, fmt.Errorf("unsupported value type: %s", reflect.TypeOf(value))
			}
			tableValue = make(amqp.Table)
			for k, v := range mapValue {
				tableValue[k] = v
			}
			headerValue[i] = tableValue
		}
	}
	return headerValue, nil
}
func unmarshalHeaderValue ( value string ) ( interface { } , error ) { var arrayValue [ ] interface { } err := json . Unmarshal ( [ ] byte ( value ) , & arrayValue ) if err != nil { return value , nil } headerValue := make ( [ ] interface { } , len ( arrayValue ) ) for i , value := range arrayValue { tableValue , ok := value . ( amqp . Table ) if ok { headerValue [ i ] = tableValue } else { mapValue , ok := value . ( map [ string ] interface { } ) if ! ok { return nil , fmt . Errorf ( " " , reflect . TypeOf ( value ) ) } tableValue = make ( amqp . Table ) for k , v := range mapValue { tableValue [ k ] = v } headerValue [ i ] = tableValue } } return headerValue , nil }
unmarshalHeaderValue checks if the value is a JSON array value and, if so, unmarshals it and returns an array.
unmarshalHeaderValue checks if the value is a JSON array value and if so unmarshals it and returns an array .
// The header is a string. //nolint:nilerr // The header is an array.