Problem
There are 12 instances of body, _ := io.ReadAll(resp.Body) in internal/devlake/client.go. The error from io.ReadAll is silently discarded.
If the TCP connection resets mid-response (possible with flaky networks, Azure Container Instances timing out, or proxy interruptions), this produces an empty or truncated body, which then fails with a confusing json.Unmarshal error:
unexpected end of JSON input
Instead of a clear:
reading response body: connection reset by peer
Fix
Replace all 12 instances of:
go body, _ := io.ReadAll(resp.Body)
With:
go body, err := io.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("reading response: %w", err) }
For functions that return error only (DeleteConnection, DeleteScope, DeleteProject), adjust the return accordingly.
Acceptance Criteria
Problem
There are 12 instances of
body, _ := io.ReadAll(resp.Body)ininternal/devlake/client.go. The error fromio.ReadAllis silently discarded.If the TCP connection resets mid-response (possible with flaky networks, Azure Container Instances timing out, or proxy interruptions), this produces an empty or truncated
body, which then fails with a confusingjson.Unmarshalerror:unexpected end of JSON inputInstead of a clear:
reading response body: connection reset by peerFix
Replace all 12 instances of:
go body, _ := io.ReadAll(resp.Body)With:
go body, err := io.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("reading response: %w", err) }For functions that return
erroronly (DeleteConnection,DeleteScope,DeleteProject), adjust the return accordingly.Acceptance Criteria
io.ReadAllcalls inclient.gohandle errorsgo build ./...andgo test ./...pass