You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add nil checks for generated API client response bodies #58
Throughout the codebase, generated API client response fields (e.g., JSON200, JSON202, JSON201) are accessed directly without nil checks. These fields are only populated when the response body deserializes successfully. A response with the expected status code but an empty or malformed body will leave these fields nil, causing a nil pointer panic.
Context
This pattern was identified during review of PR #57 (specifically in internal/api/providers/resource.go around line 153 where createResp.JSON202.Id is accessed), but it appears to be a widespread pattern throughout the codebase.
Proposed Solution
Add nil checks before dereferencing any generated client response body fields, for example:
Check if resp.JSON200 == nil before accessing resp.JSON200.Field
Return a descriptive error when the response body is nil despite receiving the expected status code
Activity