From c49170b6b336b2424ad976f55f0ea68e7b938165 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Mon, 23 Mar 2026 15:58:14 +0200 Subject: [PATCH] fix(scaletest): handle ignored io.ReadAll error in bridge runner (#22850) Surface the io.ReadAll error in the error message when an HTTP request fails with a non-200 status, instead of silently discarding it. --- scaletest/bridge/run.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scaletest/bridge/run.go b/scaletest/bridge/run.go index 09e987ef63..2c258f407d 100644 --- a/scaletest/bridge/run.go +++ b/scaletest/bridge/run.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "encoding/json" + "fmt" "io" "net/http" "strings" @@ -230,7 +231,10 @@ func (r *Runner) makeRequest(ctx context.Context, logger slog.Logger, url, token r.cfg.Metrics.ObserveDuration(duration.Seconds()) if resp.StatusCode != http.StatusOK { - body, _ := io.ReadAll(resp.Body) + body, readErr := io.ReadAll(resp.Body) + if readErr != nil { + body = []byte(fmt.Sprintf("", readErr)) + } err := xerrors.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) span.RecordError(err) return err