From cf53e6a9e271645d00d8dbdb0ae79218f37f46ec Mon Sep 17 00:00:00 2001 From: Lars Karlitski Date: Thu, 23 Apr 2020 14:04:54 +0200 Subject: [PATCH] test/helpers: include error return when route fails --- internal/test/helpers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/test/helpers.go b/internal/test/helpers.go index cf9ccffb9..9fdfa2220 100644 --- a/internal/test/helpers.go +++ b/internal/test/helpers.go @@ -108,11 +108,11 @@ func TestRoute(t *testing.T, api API, external bool, method, path, body string, t.Skip("This test is for internal testing only") } - assert.Equalf(t, expectedStatus, resp.StatusCode, "SendHTTP failed for path %s", path) - replyJSON, err := ioutil.ReadAll(resp.Body) require.NoErrorf(t, err, "%s: could not read response body", path) + assert.Equalf(t, expectedStatus, resp.StatusCode, "SendHTTP failed for path %s: %v", path, string(replyJSON)) + if expectedJSON == "" { require.Lenf(t, replyJSON, 0, "%s: expected no response body, but got:\n%s", path, replyJSON) }