We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d5740e7 commit edc8a28Copy full SHA for edc8a28
1 file changed
components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java
@@ -913,9 +913,11 @@ public long contentLength() throws IOException {
913
return Long.parseLong(
914
contentLength.toArray(new String[] {})[0]);
915
}
916
+ // super.contentLength() is not relied on since it defaults to -1L, causing wrong telemetry added to the attributes.
917
if (requestInfo.content instanceof ByteArrayInputStream) {
918
final ByteArrayInputStream contentStream =
919
(ByteArrayInputStream) requestInfo.content;
920
+ // using available() on a byte-array backed input stream is reliable because array size is defined.
921
return contentStream.available();
922
923
return super.contentLength();
0 commit comments