From cfd771083c10f62f50f741720356bda27e7bd2b4 Mon Sep 17 00:00:00 2001 From: Daulet Zhanguzin Date: Thu, 21 Nov 2024 16:16:22 -0800 Subject: [PATCH] feat: capture headers for error too --- requester.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requester.go b/requester.go index e44dcb3..039aa2f 100644 --- a/requester.go +++ b/requester.go @@ -266,7 +266,8 @@ func (r *Requester) DoRequest(req *fasthttp.Request, resp *fasthttp.Response, rr writeTo := io.Discard if resp.StatusCode() >= 500 { writeTo = r.errWriter - _, _ = r.errWriter.Write([]byte(fmt.Sprintf("\n%d %s\n", resp.StatusCode(), rr.cost))) + _, _ = r.errWriter.Write([]byte(fmt.Sprintf("\n%d %s", resp.StatusCode(), rr.cost))) + _, _ = r.errWriter.Write([]byte(fmt.Sprintf("%s\n", &resp.Header))) } err = resp.BodyWriteTo(writeTo) if err != nil {