fix: handle nil body in http log
commit7f7749601a0792f772c0fffdbc73e05121b5055e
authorKujtim Hoxha <kujtimii.h@gmail.com>
dateSat 2 Aug 2025, 10:42 (1 year ago)
parent8940ba1
internal/log/http.go+3
@@ -79,6 +79,9 @@ func (h *HTTPRoundTripLogger) RoundTrip(req *http.Request) (*http.Response, erro
7979}
8080
8181func bodyToString(body io.ReadCloser) string {
82+ if body == nil {
83+ return ""
84+ }
8285 src, err := io.ReadAll(body)
8386 if err != nil {
8487 slog.Error("Failed to read body", "error", err)