Skip to content

Commit bdfaf9f

Browse files
committed
integration_tests/request_upstream: print body when test flakes
1 parent 30ccd01 commit bdfaf9f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

integration_tests/request_upstream/main_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ func requestUpstreamBody(t *testing.T, body io.Reader, size int, chunked bool) {
142142
Headers map[string]string `json:"headers"`
143143
}
144144

145-
if err := json.NewDecoder(resp.Body).Decode(&respData); err != nil {
146-
t.Fatalf("Decode: %v", err)
145+
gotBody := new(bytes.Buffer)
146+
if err := json.NewDecoder(io.TeeReader(resp.Body, gotBody)).Decode(&respData); err != nil {
147+
t.Fatalf("Decode: %v\nBody:\n%s", err, gotBody.String())
147148
}
148149

149150
var teWant, clWant string

0 commit comments

Comments
 (0)