From 4cf901fb752533f3154658f4ad6b73b1ff872fbb Mon Sep 17 00:00:00 2001 From: andig Date: Wed, 15 Mar 2023 14:52:09 +0100 Subject: [PATCH] chore: add http status description --- util/request/functions.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/request/functions.go b/util/request/functions.go index 84cc1f1ae..b9d7d14dd 100644 --- a/util/request/functions.go +++ b/util/request/functions.go @@ -36,20 +36,20 @@ func NewStatusError(resp *http.Response) StatusError { } func (e StatusError) Error() string { - return fmt.Sprintf("unexpected status: %d", e.resp.StatusCode) + return fmt.Sprintf("unexpected status: %d (%s)", e.resp.StatusCode, http.StatusText(e.resp.StatusCode)) } -// Response returns the respose with the unexpected error +// Response returns the response with the unexpected error func (e StatusError) Response() *http.Response { return e.resp } -// StatusCode returns the respose's status code +// StatusCode returns the response's status code func (e StatusError) StatusCode() int { return e.resp.StatusCode } -// HasStatus returns true if the respose's status code matches any of the given codes +// HasStatus returns true if the response's status code matches any of the given codes func (e StatusError) HasStatus(codes ...int) bool { for _, code := range codes { if e.resp.StatusCode == code {