Skip to content

Commit

Permalink
Update request body write to retain inputstream buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ndiritu committed Aug 19, 2024
1 parent 6291fa2 commit 418176a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions components/http/okHttp/gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies {
implementation 'io.opentelemetry:opentelemetry-api:1.41.0'
implementation 'io.opentelemetry:opentelemetry-context:1.41.0'
implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
implementation 'com.google.guava:guava:33.3.0-jre'
api 'com.squareup.okhttp3:okhttp:4.12.0'

api project(':components:abstractions')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static com.microsoft.kiota.http.TelemetrySemanticConventions.*;

import com.google.guava.ByteStreams;
import com.microsoft.kiota.*;
import com.microsoft.kiota.authentication.AuthenticationProvider;
import com.microsoft.kiota.http.middleware.ParametersNameDecodingHandler;
Expand All @@ -28,7 +29,6 @@
import okhttp3.*;

import okio.BufferedSink;
import okio.Okio;

import java.io.ByteArrayInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -922,7 +922,7 @@ public long contentLength() throws IOException {

@Override
public void writeTo(@Nonnull BufferedSink sink) throws IOException {
sink.writeAll(Okio.source(requestInfo.content));
sink.write(ByteStreams.toByteArray(requestInfo.content));
}
};

Expand Down

0 comments on commit 418176a

Please sign in to comment.