Skip to content

Commit 00c651d

Browse files
authored
Read the body witohut waiting for -1 in the smoke test (#282)
Signed-off-by: Pavol Loffay <[email protected]>
1 parent 8e5e87a commit 00c651d

File tree

1 file changed

+5
-8
lines changed
  • smoke-tests/matrix/src/main/java/io/opentelemetry/smoketest/matrix

1 file changed

+5
-8
lines changed

smoke-tests/matrix/src/main/java/io/opentelemetry/smoketest/matrix/EchoServlet.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,13 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
3838
"\n" + headers).getBytes());
3939
response.setHeader("Header-Dump", headerResponseBody);
4040

41-
4241
//get set echo body
4342
ServletInputStream inputStream = request.getInputStream();
44-
ServletOutputStream outputStream = response.getOutputStream();
45-
int currentByte = inputStream.read();
46-
while (currentByte != -1) {
47-
outputStream.write(currentByte);
48-
currentByte = inputStream.read();
49-
}
50-
response.getOutputStream().flush();
43+
// read the body without waiting for -1
44+
// e.g. Jackson reads the body without waiting for returning -1
45+
byte[] bodyBytes = new byte[1500000];
46+
inputStream.read(bodyBytes);
47+
response.getOutputStream().write(bodyBytes);
5148
}
5249
}
5350
}

0 commit comments

Comments
 (0)