mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-09 22:56:10 +00:00
Fix issue with buffered sink handling in OkHttp (#5786)
* Fix issue with buffered sink handling in okhttp Fixes unexpected end of stream exceptions when using the okhttp-gson library and making asynchronous calls. * update petstore samples for okhttp-gson $ ./bin/java-petstore-okhttp-gson.sh $ ./bin/security/java-petstore-okhttp-gson.sh * WIP: trigger ci
This commit is contained in:
@@ -34,8 +34,6 @@ public class ProgressRequestBody extends RequestBody {
|
||||
|
||||
private final ProgressRequestListener progressListener;
|
||||
|
||||
private BufferedSink bufferedSink;
|
||||
|
||||
public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) {
|
||||
this.requestBody = requestBody;
|
||||
this.progressListener = progressListener;
|
||||
@@ -53,13 +51,9 @@ public class ProgressRequestBody extends RequestBody {
|
||||
|
||||
@Override
|
||||
public void writeTo(BufferedSink sink) throws IOException {
|
||||
if (bufferedSink == null) {
|
||||
bufferedSink = Okio.buffer(sink(sink));
|
||||
}
|
||||
|
||||
BufferedSink bufferedSink = Okio.buffer(sink(sink));
|
||||
requestBody.writeTo(bufferedSink);
|
||||
bufferedSink.flush();
|
||||
|
||||
}
|
||||
|
||||
private Sink sink(Sink sink) {
|
||||
|
||||
Reference in New Issue
Block a user