From 092f37a6365589eef06ecff3e3a7c1dbd1487001 Mon Sep 17 00:00:00 2001 From: David Wertenteil Date: Wed, 3 May 2023 08:39:59 +0300 Subject: [PATCH] if the response is empty, return an empty string Signed-off-by: David Wertenteil --- core/cautils/getter/utils.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/cautils/getter/utils.go b/core/cautils/getter/utils.go index 6e12d21d..59d5dd8f 100644 --- a/core/cautils/getter/utils.go +++ b/core/cautils/getter/utils.go @@ -67,6 +67,12 @@ func errAuth(resp *http.Response) error { } func readString(rdr io.Reader, sizeHint int64) (string, error) { + + // if the response is empty, return an empty string + if sizeHint < 0 { + return "", nil + } + var b strings.Builder b.Grow(int(sizeHint))