From 3f2a408f52789ab9089abdd521cf9339bacf87ea Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Wed, 3 Dec 2025 01:15:21 +0100 Subject: [PATCH] fix: prevent panic in report template when dump fails replace panics with error messages in the dump template function, allowing test reports to render gracefully on timeouts fixes #251 --- tooling/test/report.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tooling/test/report.go b/tooling/test/report.go index 40955ea59..be2289e8a 100644 --- a/tooling/test/report.go +++ b/tooling/test/report.go @@ -74,11 +74,11 @@ func report(t *testing.T, test SugarTest, req *http.Request, res *http.Response, // "http: ContentLength=6 with Body length 0" b, err = httputil.DumpResponse(v, false) default: - panic("unknown type") + return fmt.Sprintf("error: unknown type %T", v) } if err != nil { - panic(err) + return fmt.Sprintf("error: failed to dump %T: %v", v, err) } return string(b)