Skip to content

FindAllStats: Fix to get the json of resource when not an array#36

Open
ak1ra24 wants to merge 1 commit intonetscaler:mainfrom
ak1ra24:support-to-get-non-array-json
Open

FindAllStats: Fix to get the json of resource when not an array#36
ak1ra24 wants to merge 1 commit intonetscaler:mainfrom
ak1ra24:support-to-get-non-array-json

Conversation

@ak1ra24
Copy link
Copy Markdown

@ak1ra24 ak1ra24 commented Aug 27, 2022

Resolve #35.

The FindAllStats function was implemented with the condition that the json resource tag contains an array,
so it has been modified to handle []interface{} or map[string]interface{} in the type evaluation.

senhub-io pushed a commit to senhub-io/adc-nitro-go that referenced this pull request Dec 11, 2025
…node)

This fixes the panic that occurs when FindAllStats() is called on singleton
resources like system, ns, ssl, or hanode. These resources return a single
object (map[string]interface{}) instead of an array ([]interface{}).

The fix uses a type switch to handle both cases:
- Array response: process normally (lbvserver, service, servicegroup)
- Singleton response: wrap in array to maintain consistent return type

This resolves issue netscaler#35 and implements the fix from PR netscaler#36.

TEMPORARY FORK: This is a temporary fork until the official SDK merges the fix.
Upstream PR: netscaler#36
Upstream Issue: netscaler#35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FindAllStats: panic fails on Hanode

1 participant