From 886f873fa4f2d87b27c0f6069cc97395f72e398f Mon Sep 17 00:00:00 2001 From: freddygv Date: Tue, 14 Sep 2021 18:45:39 -0600 Subject: [PATCH] Trim newlines before parenthesis end --- api/api.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/api.go b/api/api.go index ec48355684..4889721060 100644 --- a/api/api.go +++ b/api/api.go @@ -1117,7 +1117,9 @@ func generateUnexpectedResponseCodeError(resp *http.Response) error { var buf bytes.Buffer io.Copy(&buf, resp.Body) closeResponseBody(resp) - return fmt.Errorf("Unexpected response code: %d (%s)", resp.StatusCode, buf.Bytes()) + + trimmed := strings.TrimSpace(string(buf.Bytes())) + return fmt.Errorf("Unexpected response code: %d (%s)", resp.StatusCode, trimmed) } func requireNotFoundOrOK(d time.Duration, resp *http.Response, e error) (bool, time.Duration, *http.Response, error) {