Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HttpRequest Body Being Consumed and Sending an Empty Request Body #14915

Merged
merged 2 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ com.microsoft.azure:spring-cloud-azure-eventhubs-stream-binder;1.2.8-beta.1;1.2.
# Format;
# unreleased_<groupId>:<artifactId>;dependency-version
# note: The unreleased dependencies will not be manipulated with the automatic PR creation code.
unreleased_com.azure:azure-core;1.9.0-beta.1
unreleased_com.azure:azure-core-test;1.5.0-beta.1
unreleased_com.azure:azure-core-http-netty;1.7.0-beta.1
unreleased_com.azure:azure-core-http-okhttp;1.4.0-beta.1
unreleased_com.azure:azure-identity;1.2.0-beta.1
unreleased_com.azure:azure-core-amqp;1.5.0-beta.1
unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.5
unreleased_com.azure:azure-security-keyvault-keys;4.3.0-beta.1
Expand Down
10 changes: 5 additions & 5 deletions sdk/appconfiguration/azure-data-appconfiguration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,25 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.8.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
<version>1.9.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
<version>1.6.0</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} -->
<version>1.7.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-http-netty;dependency} -->
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.4.1</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.5.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-okhttp</artifactId>
<version>1.3.0</version> <!-- {x-version-update;com.azure:azure-core-http-okhttp;dependency} -->
<version>1.4.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-http-okhttp;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -90,7 +90,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.1.0</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
<version>1.2.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-identity;dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ private HttpRequest configRequest(final HttpRequest request, final SwaggerMethod
serializer.serialize(bodyContentObject, SerializerEncoding.JSON, stream);

request.setHeader("Content-Length", String.valueOf(stream.size()));
request.setBody(Flux.just(ByteBuffer.wrap(stream.toByteArray(), 0, stream.size())));
request.setBody(Flux.defer(() -> Flux.just(ByteBuffer.wrap(stream.toByteArray(), 0, stream.size()))));
} else if (FluxUtil.isFluxByteBuffer(methodParser.getBodyJavaType())) {
// Content-Length or Transfer-Encoding: chunked must be provided by a user-specified header when a
// Flowable<byte[]> is given for the body.
Expand All @@ -298,7 +298,7 @@ private HttpRequest configRequest(final HttpRequest request, final SwaggerMethod
serializer.serialize(bodyContentObject, SerializerEncoding.fromHeaders(request.getHeaders()), stream);

request.setHeader("Content-Length", String.valueOf(stream.size()));
request.setBody(Flux.just(ByteBuffer.wrap(stream.toByteArray(), 0, stream.size())));
request.setBody(Flux.defer(() -> Flux.just(ByteBuffer.wrap(stream.toByteArray(), 0, stream.size()))));
}
}

Expand Down
10 changes: 5 additions & 5 deletions sdk/formrecognizer/azure-ai-formrecognizer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,25 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.8.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
<version>1.9.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
<version>1.6.0</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} -->
<version>1.7.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-http-netty;dependency} -->
</dependency>

<!-- Test Dependencies -->
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.4.1</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.5.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-okhttp</artifactId>
<version>1.3.0</version> <!-- {x-version-update;com.azure:azure-core-http-okhttp;dependency} -->
<version>1.4.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-http-okhttp;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -78,7 +78,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.1.0</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
<version>1.2.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-identity;dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
4 changes: 2 additions & 2 deletions sdk/identity/azure-identity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.8.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
<version>1.9.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core;dependency} -->
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
Expand Down Expand Up @@ -83,7 +83,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
<version>1.6.0</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} -->
<version>1.7.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-http-netty;dependency} -->
<scope>test</scope>
</dependency>
<!-- for file lock tests, ideally should be removed in the future -->
Expand Down
10 changes: 5 additions & 5 deletions sdk/textanalytics/azure-ai-textanalytics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.8.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
<version>1.9.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
<version>1.6.0</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} -->
<version>1.7.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-http-netty;dependency} -->
</dependency>

<!-- Added this dependency to include necessary annotations used by reactor core.
Expand All @@ -58,13 +58,13 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.4.1</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.5.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-okhttp</artifactId>
<version>1.3.0</version> <!-- {x-version-update;com.azure:azure-core-http-okhttp;dependency} -->
<version>1.4.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-http-okhttp;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -88,7 +88,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.1.0</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
<version>1.2.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-identity;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down