Skip to content

Commit

Permalink
Set a mark at the beginning of the stream before reading it
Browse files Browse the repository at this point in the history
  • Loading branch information
Ndiritu committed Dec 23, 2024
1 parent 03bd370 commit 7e0e064
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -904,12 +904,12 @@ public void writeTo(@Nonnull BufferedSink sink) throws IOException {
// stored in variable before writing to the sink due to
// available()'s definition
long contentLength = contentLength();
if (contentLength() > 0) {
requestInfo.content.mark((int) contentLength);
}
sink.writeAll(Okio.source(requestInfo.content));
if (!isOneShot()) {
try {
if (contentLength > 0) {
requestInfo.content.mark((int) contentLength);
}
requestInfo.content.reset();
} catch (Exception ex) {
spanForAttributes.recordException(ex);
Expand Down

0 comments on commit 7e0e064

Please sign in to comment.