From 8275db1a6391bf8b579f1f3966a1576f6112780c Mon Sep 17 00:00:00 2001 From: Jan Novak Date: Thu, 7 May 2026 10:36:20 +0200 Subject: [PATCH] fix(go/fio): nil http client panic in fio.New When token is empty, New falls back to transparentClient with the caller-supplied hc. main.go passes nil, so the first Do() call panicked. Default to http.DefaultClient when hc is nil. Co-Authored-By: Claude Opus 4.7 --- go/internal/io/fio/client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/go/internal/io/fio/client.go b/go/internal/io/fio/client.go index 4ff3ae2..db40d54 100644 --- a/go/internal/io/fio/client.go +++ b/go/internal/io/fio/client.go @@ -4,6 +4,7 @@ package fio import ( "context" + "net/http" "time" ) @@ -29,7 +30,11 @@ type Client interface { } // New returns an apiClient when token is non-empty, otherwise a transparentClient. +// hc may be nil, in which case http.DefaultClient is used. func New(token, accountNum string, hc httpDoer) Client { + if hc == nil { + hc = http.DefaultClient + } if token != "" { return &apiClient{token: token, hc: hc} }