Skip to content

Commit

Permalink
feat: capture headers for error too
Browse files Browse the repository at this point in the history
  • Loading branch information
daulet committed Nov 22, 2024
1 parent c49565c commit cfd7710
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit cfd7710

Please sign in to comment.