Skip to content

Commit

Permalink
read chunked response
Browse files Browse the repository at this point in the history
Signed-off-by: chahatsagarmain <[email protected]>
  • Loading branch information
chahatsagarmain committed Jan 4, 2025
1 parent c62346f commit cdefef7
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions cmd/query/app/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,9 +916,20 @@ func TestServerHTTP_TracesRequest(t *testing.T) {
resp, err := client.Do(req)
require.NoError(t, err)

body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
require.NotEmpty(t, body, "Response body should not be empty")
var fullResponse bytes.Buffer

buf := make([]byte, 1024)
for {
n, err := resp.Body.Read(buf)

if n > 0 {
fullResponse.Write(buf[:n])
}

if err == io.EOF {
break
}
}

if test.expectedTrace != "" {
assert.Len(t, exporter.GetSpans(), 1, "HTTP request was traced and span reported")
Expand Down

0 comments on commit cdefef7

Please sign in to comment.