Skip to content

Commit

Permalink
fix: Handle failure to reset request body streams after writing reque…
Browse files Browse the repository at this point in the history
…st body
  • Loading branch information
Ndiritu committed Dec 23, 2024
1 parent 91d4f87 commit ae47a97
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,15 @@ public long contentLength() throws IOException {
public void writeTo(@Nonnull BufferedSink sink) throws IOException {
sink.writeAll(Okio.source(requestInfo.content));
if (!isOneShot()) {
requestInfo.content.reset();
try {
requestInfo.content.reset();
} catch (Exception ex) {
spanForAttributes.recordException(ex);
// we don't want to fail the request if reset() fails
// reset() was a measure to prevent draining the request
// body by an interceptor before
// the final network request
}
}
}
};
Expand Down

0 comments on commit ae47a97

Please sign in to comment.