if the response is empty, return an empty string

Signed-off-by: David Wertenteil <dwertent@armosec.io>
This commit is contained in:
David Wertenteil
2023-05-03 08:39:59 +03:00
parent 7609a4aa5d
commit 092f37a636
+6
View File
@@ -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))