From e4dd84e3f6fb08b5ff149530b1f20bde90584b37 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Wed, 21 Aug 2024 22:30:02 +0300 Subject: [PATCH] Update isOneShot check and reset stream if possible --- .../java/com/microsoft/kiota/http/OkHttpRequestAdapter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java index aecfd6682..028afe64c 100644 --- a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java +++ b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java @@ -901,7 +901,7 @@ public MediaType contentType() { @Override public boolean isOneShot() { - return true; + return !requestInfo.content.markSupported(); } @Override @@ -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(); + } } };