From be5188a4ed01687a8afc1e75110bc6ce257682dd Mon Sep 17 00:00:00 2001 From: Jo <10510431+j178@users.noreply.github.com> Date: Thu, 4 Apr 2024 09:42:09 +0800 Subject: [PATCH] fix: slice range panic (#291) --- leetcode/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leetcode/client.go b/leetcode/client.go index f068e656..093f771d 100644 --- a/leetcode/client.go +++ b/leetcode/client.go @@ -44,7 +44,7 @@ type UnexpectedStatusCode struct { func (e UnexpectedStatusCode) Error() string { body := "" - if len(e.Body) > 0 { + if len(e.Body) > 1024 { body = e.Body[:1024] } return fmt.Sprintf("[%d %s] %s", e.Code, http.StatusText(e.Code), body)