Skip to content

Commit

Permalink
integration_tests/request_upstream: print body when test flakes
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-dub committed Jun 20, 2024
1 parent 30ccd01 commit bdfaf9f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions integration_tests/request_upstream/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ func requestUpstreamBody(t *testing.T, body io.Reader, size int, chunked bool) {
Headers map[string]string `json:"headers"`
}

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

var teWant, clWant string
Expand Down

0 comments on commit bdfaf9f

Please sign in to comment.