-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Description
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 == nilbefore accessingresp.JSON200.Field - Return a descriptive error when the response body is nil despite receiving the expected status code
Related
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels