File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
components/http/okHttp/src/main/java/com/microsoft/kiota/http Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -901,9 +901,21 @@ public long contentLength() throws IOException {
901901
902902 @ Override
903903 public void writeTo (@ Nonnull BufferedSink sink ) throws IOException {
904+ long contentLength = contentLength ();
905+ if (contentLength > 0 ) {
906+ requestInfo .content .mark ((int ) contentLength );
907+ }
904908 sink .writeAll (Okio .source (requestInfo .content ));
905909 if (!isOneShot ()) {
906- requestInfo .content .reset ();
910+ try {
911+ requestInfo .content .reset ();
912+ } catch (Exception ex ) {
913+ spanForAttributes .recordException (ex );
914+ // we don't want to fail the request if reset() fails
915+ // reset() was a measure to prevent draining the request
916+ // body by an interceptor before
917+ // the final network request
918+ }
907919 }
908920 }
909921 };
You can’t perform that action at this time.
0 commit comments