Skip to content

Commit

Permalink
Update isOneShot check and reset stream if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Ndiritu committed Aug 22, 2024
1 parent ed319bb commit e4dd84e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ public MediaType contentType() {

@Override
public boolean isOneShot() {
return true;
return !requestInfo.content.markSupported();
}

@Override
Expand All @@ -928,6 +928,9 @@ public long contentLength() throws IOException {
@Override
public void writeTo(@Nonnull BufferedSink sink) throws IOException {
sink.writeAll(Okio.source(requestInfo.content));
if (!isOneShot()) {
requestInfo.content.reset();
}
}
};

Expand Down

0 comments on commit e4dd84e

Please sign in to comment.