fix: handle nil body in http log

Kujtim Hoxha created

Change summary

internal/log/http.go | 3 +++
1 file changed, 3 insertions(+)

Detailed changes

internal/log/http.go 🔗

@@ -79,6 +79,9 @@ func (h *HTTPRoundTripLogger) RoundTrip(req *http.Request) (*http.Response, erro
 }
 
 func bodyToString(body io.ReadCloser) string {
+	if body == nil {
+		return ""
+	}
 	src, err := io.ReadAll(body)
 	if err != nil {
 		slog.Error("Failed to read body", "error", err)