Skip to content

Commit

Permalink
[Cosmos][VectorSearch] Non Streaming Order By Query (#40115)
Browse files Browse the repository at this point in the history
* Initial changes

* Initial changes

* Increment versions for core releases (#40003)

Increment package versions for core releases

* Ensure ServiceBus session idle timeout fall back to retry-options::try-timeout (#39994)

* Added Alpha3 Java Media Streaming Events (#40002)

* Added Alpha3 Java Media Streaming Events

* updating readme to add the media streaming events to remove model

---------

Co-authored-by: Vinothini Dharmaraj <v-vdharmaraj@microsoft.com>

* Update version of github-event-processor to 1.0.0-dev.20240502.2 (#40012)

Co-authored-by: James Suplizio <jasupliz@microsoft.com>

* Prepare May 2024 Identity Release (#40006)

* Prepare Identity Broker May 2024 Release (#40014)

* Increment package versions for identity releases (#40015)

* [JobRouter] SDK Review updates (#40011)

* SDK Review updates

* Update auto-generated models

* Add customization

* Fix customization

* Update package

* Update tests

* Linting

* FixFaultInjectionRuleFailedToApplyPerPartitionInGatewayMode (#40005)

* fix fault injection rule failed to apply per partition in gateway mode

---------

Co-authored-by: annie-mac <xinlian@microsoft.com>

* azure-cosmos-test_1.0.0.beta.7Release (#40021)

* release azure-cosmos-test 1.0.0.beta.7
---------

Co-authored-by: annie-mac <xinlian@microsoft.com>

* Fixed existsById API in ReactiveCosmosTemplate (#40022)

* Fixed existsById API in ReactiveCosmosTemplate

* Added changelog

* Initial changes

* Initial changes

* Skip Recorded test and delete Event record until test proxy to work with Event recordings (#40029)

Co-authored-by: Min Woo Lee 🧊 <77083090+minwoolee-ms@users.noreply.github.com>

* Fix invalid CODEOWNERS (#40032)

* Initial changes

* ServiceBus: fix session tracing (#39962)

* remove additional matrix

* Fix session processing and disposition instrumentation

* return matrix config

* review suggestions

* [Automation] Generate SDK based on TypeSpec 0.15.15 (#40048)

* [CODEOWNERS] Updates for org changes (#40049)

* [CODEOWNERS] Updates for org changes

The focus of these changes is to remove an individual who no longer is responsible for the products which their GH account is associated to.

* Move from using the docker image to java2docfx for docs validation (#39744)

* Move from using the docker image to java2docfx for docs validation

* Temporarily turn on docs processing for template libraries for testing

* Actually install the rex validation tool

* Fix the if not Test-Path statement

* Update java2docfx version and add a couple of diagnostics output lines

* Add missing close paren

* Ensure that Sort-Object always returns an array even if there's only one item

* add another piece of diagnostics output

* trying one more thing

* remove some diag, add other

* Remove the additional diagnostics, add permanent output message

* Invoke java -jar on java2docfx to show the help command to ensure the install is okay

* fiddling with the java -jar command

* Set the working directory to the java2docfx directory before executing the mvn dependency download

* Actually create the directory before trying to set location...oops

* Update rex validation to verify MAVEN_HOME is set

* Updates for Java PR 39875 which had changes from this PR that were more immediate

* Update java2docfx version

* remove check for MAVEN_HOME which was only for testing

* Update the version of java2docfx to test a fix

* Update version of java2docfx to 1.0.4

* revert template's ci.yml changes that were only necessary to test java2docfx

* owners (#39686)

* Use ClientLogger in testing output (#40010)

Use ClientLogger in testing output

* Fix null pointer exception and context usage (#40053)

* Rename AML to AzureMachineLearning (#40056)

* Fixed the Key Vault `test-resources.json` file to properly configure a deployment script for certificate creation. (#40037)

* Close response body in bearer policy (#40052)

* Running Prepare-Release for azure-messaging-servicebus 7.17.0 (#40058)

* mgmt, TypeSpec code generation pipeline (#39963)

* typespec generation pipeline

echo command

PR_TITLE

* generation typespec

Update generation.yml for Azure Pipelines

Update generation.yml for Azure Pipelines

Update generation.yml for Azure Pipelines

* remove typespec pipeline file

* fix pr title

* address comments

* Add codeowner linter owners (#39997)

* Update to ESRP task version that supports federated auth (#40059)

* Increment package versions for cosmos releases (#40031)

* Update azure-sdk-build-tools Repository Resource Refs in Yaml files (#39627)

* Add reduced embeddings sample to azure-search-documents (#40069)

* Add reduced embeddings sample

* Fix cspell

* Fix link

* Search May Preview Regen Updates (#40057)

* Search May Preview Regeneration
- Still need to add varargs convenience

* Removing ovveride statements from `setFields` for `VectorizableImageUrlQuery` and `VectorizableImageBinaryQuery`

* Removing ovveride statements from `setFields` for `VectorizableImageUrlQuery` and `VectorizableImageBinaryQuery`

* adding varargs

* Additional adjustments to FieldBuilder and Search Index Customizations

* Updating cspell.json

* Adjust `SearchScoreThreshold` customization
Re-enable code generation in CI

* Updates:

- Updated Cspell
- Rename `maxStoragePerIndex` property to `maxStoragePerIndexInBytes` in SearchServiceLimits
- Set `hybridSearch` property to be type `HybridSearch` in SearchRequest
- Add `hybridSearch` to SearchOptions and `SearchAsyncClient.createSearchRequest()`

* Adding Support and testing byte[] and List<byte> within field builder

* Fix linting

---------

Co-authored-by: alzimmermsft <48699787+alzimmermsft@users.noreply.github.com>

* Preparing Search May 2024 Beta Release (#40071)

* Preparing Search May 2024 Beta Release

* Preparing Search May 2024 Beta Release

* Resolving comments

* Fixing build issues

* eng, update autorest.java, improve error output in sdk automation (#40073)

* improve error output

* autorest.java 4.1.29

* Merge to main after spring cloud azure 4.18.0 released (#40075)

* Prepare for Spring Cloud Azure 4.18.0 release (#40063)

* update version client

* update version/changelog/readme

* update changelog

* Increment versions for spring releases (#40074)

* Increment package versions for spring releases

* Update version_client.txt

* Update pom.xml

---------

Co-authored-by: Muyao Feng <92105726+Netyyyy@users.noreply.github.com>

---------

Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com>

* Miscellaneous Core performance improvements (#39552)

Miscellaneous Core performance improvements

* Increment package versions for search releases (#40072)

* Update io.fabric8:kubernetes-client (#40086)

5.12.3 -> 6.12.1

* Increment package versions for servicebus releases (#40094)

* Emit stable auto-instrumented otel metrics (#39960)

* Update otel metrics logic

* add runtime metrics

* adding a few metrics I forgot

* small correction

* Update

* Fix

* Update

* Delete pre-stable metrics

---------

Co-authored-by: Harsimar Kaur (from Dev Box) <harskaur@microsoft.com>

* [Key Vault] Added support for `/prerestore` and `/prebackup` endpoints in Backup clients (#39878)

* Updated `autorest.md` files in all swagger folders.

* Re-generated implementation code.

* Updated ServiceVersion expandable enums.

* Added public APIs for the new /prebacukp and /prerestore endpoints.

* Added tests.

* Refactored Backup client tests.

* Updated tests.

* Updated test recordings.

* Updated documentation and samples.

* Addressed PR feedback.

* Initial changes

* Prepare to release beta.22 (#40097)

* Fix template name (#40099)

* Fix template name

* Also install the rex validation tool

* Update partner release to use WIF (#40101)

* core mgmt, `SubResource` implements `JsonSerializable` to support azure-json (#40076)

* test

* implementation

* fix lint

* spotless:apply

* Update spring-reference and sync changelog (#40105)

* update spring-reference.yml

* update CHANGELOG.md

* Support per-call response timeout in all HttpClient implementations (#40017)

Support per-call response timeout in all HttpClient implementations

* Change how JavaType is resolved to support JsonSerializable better (#40112)

* Initial changes

* Fixes

---------

Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com>
Co-authored-by: Anu Thomas Chandy <anuamd@hotmail.com>
Co-authored-by: v-durgeshs <146056835+v-durgeshs@users.noreply.github.com>
Co-authored-by: Vinothini Dharmaraj <v-vdharmaraj@microsoft.com>
Co-authored-by: James Suplizio <jasupliz@microsoft.com>
Co-authored-by: Bill Wert <billwert@microsoft.com>
Co-authored-by: williamzhao87 <williamzhao87@users.noreply.github.com>
Co-authored-by: Annie Liang <64233642+xinlian12@users.noreply.github.com>
Co-authored-by: annie-mac <xinlian@microsoft.com>
Co-authored-by: Kushagra Thapar <kuthapar@microsoft.com>
Co-authored-by: minwoolee-msft <77083090+minwoolee-msft@users.noreply.github.com>
Co-authored-by: Min Woo Lee 🧊 <77083090+minwoolee-ms@users.noreply.github.com>
Co-authored-by: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com>
Co-authored-by: Liudmila Molkova <limolkova@microsoft.com>
Co-authored-by: Jesse Squire <jsquire@microsoft.com>
Co-authored-by: Harsimar Kaur <skaur21@gmail.com>
Co-authored-by: vcolin7 <vicolina@microsoft.com>
Co-authored-by: Xiaofei Cao <92354331+XiaofeiCao@users.noreply.github.com>
Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com>
Co-authored-by: Patrick Hallisey <pahallis@microsoft.com>
Co-authored-by: Jair Myree <jairmyree@microsoft.com>
Co-authored-by: Weidong Xu <weidxu@microsoft.com>
Co-authored-by: Muyao Feng <92105726+Netyyyy@users.noreply.github.com>
Co-authored-by: Helen <56097766+heyams@users.noreply.github.com>
Co-authored-by: Harsimar Kaur (from Dev Box) <harskaur@microsoft.com>
  • Loading branch information
1 parent c8de52f commit 52917f9
Show file tree
Hide file tree
Showing 97 changed files with 3,653 additions and 2,028 deletions.
4 changes: 3 additions & 1 deletion eng/pipelines/docindex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ jobs:
parameters:
DailyBranchVariableName: DailyDocsBranchName

- template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml
- template: /eng/pipelines/templates/steps/mvn-linux-repository-settings.yml

- template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml

- task: Powershell@2
inputs:
Expand Down
18 changes: 13 additions & 5 deletions eng/pipelines/partner-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,20 @@ extends:

- template: /eng/pipelines/templates/steps/download-credscan-suppressions.yml

- task: PowerShell@2
displayName: 'Download packages from blob storage'
- task: AzurePowerShell@5
displayName: 'Copy from azuresdkpartnerdrops'
condition: and(succeeded(), ne(variables['SkipCopyFromPartnerDrops'], 'true'))
inputs:
targetType: filePath
filePath: '$(BuildToolScripts)/copy-from-azuresdkpartnerdrops.ps1'
arguments: '$(Artifacts) ${{ parameters.BlobPath }} $(azuresdkpartnerdrops-access-key)'
azureSubscription: 'azuresdkpartnerdrops - Storage Partner Drops'
ScriptType: 'InlineScript'
azurePowerShellVersion: LatestVersion
pwsh: true
Inline: |
azcopy copy 'https://azuresdkpartnerdrops.blob.core.windows.net/drops/${{ parameters.BlobPath }}/*' '$(Artifacts)' --recursive=true
echo "Copied files:"
dir '$(Artifacts)' -r | % { $_.FullName }
env:
AZCOPY_AUTO_LOGIN_TYPE: 'PSCRED'

- template: tools/java-esrp-signing/java-esrp-signing.yml@azure-sdk-build-tools
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.azure.core.http.jdk.httpclient.implementation.InputStreamTimeoutResponseSubscriber;
import com.azure.core.http.jdk.httpclient.implementation.JdkHttpResponseAsync;
import com.azure.core.http.jdk.httpclient.implementation.JdkHttpResponseSync;
import com.azure.core.implementation.util.HttpUtils;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import reactor.core.publisher.Mono;
Expand All @@ -31,8 +32,6 @@
*/
class JdkHttpClient implements HttpClient {
private static final ClientLogger LOGGER = new ClientLogger(JdkHttpClient.class);
private static final String AZURE_EAGERLY_READ_RESPONSE = "azure-eagerly-read-response";
private static final String AZURE_IGNORE_RESPONSE_BODY = "azure-ignore-response-body";

private final java.net.http.HttpClient jdkHttpClient;

Expand Down Expand Up @@ -79,8 +78,8 @@ public Mono<HttpResponse> send(HttpRequest request) {

@Override
public Mono<HttpResponse> send(HttpRequest request, Context context) {
boolean eagerlyReadResponse = (boolean) context.getData(AZURE_EAGERLY_READ_RESPONSE).orElse(false);
boolean ignoreResponseBody = (boolean) context.getData(AZURE_IGNORE_RESPONSE_BODY).orElse(false);
boolean eagerlyReadResponse = (boolean) context.getData(HttpUtils.AZURE_EAGERLY_READ_RESPONSE).orElse(false);
boolean ignoreResponseBody = (boolean) context.getData(HttpUtils.AZURE_IGNORE_RESPONSE_BODY).orElse(false);

Mono<java.net.http.HttpRequest> jdkRequestMono = Mono.fromCallable(() -> toJdkHttpRequest(request, context));

Expand Down Expand Up @@ -111,8 +110,8 @@ public Mono<HttpResponse> send(HttpRequest request, Context context) {

@Override
public HttpResponse sendSync(HttpRequest request, Context context) {
boolean eagerlyReadResponse = (boolean) context.getData(AZURE_EAGERLY_READ_RESPONSE).orElse(false);
boolean ignoreResponseBody = (boolean) context.getData(AZURE_IGNORE_RESPONSE_BODY).orElse(false);
boolean eagerlyReadResponse = (boolean) context.getData(HttpUtils.AZURE_EAGERLY_READ_RESPONSE).orElse(false);
boolean ignoreResponseBody = (boolean) context.getData(HttpUtils.AZURE_IGNORE_RESPONSE_BODY).orElse(false);

java.net.http.HttpRequest jdkRequest = toJdkHttpRequest(request, context);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
import java.util.Set;
import java.util.concurrent.Executor;

import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT;
import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_READ_TIMEOUT;
import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT;
import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT;
import static com.azure.core.util.CoreUtils.getDefaultTimeoutFromEnvironment;
import static com.azure.core.implementation.util.HttpUtils.getDefaultConnectTimeout;
import static com.azure.core.implementation.util.HttpUtils.getDefaultReadTimeout;
import static com.azure.core.implementation.util.HttpUtils.getDefaultResponseTimeout;
import static com.azure.core.implementation.util.HttpUtils.getDefaultWriteTimeout;
import static com.azure.core.implementation.util.HttpUtils.getTimeout;

/**
* Builder to configure and build an instance of the azure-core {@link HttpClient} type using the JDK HttpClient APIs,
Expand All @@ -38,12 +38,6 @@
public class JdkHttpClientBuilder {
private static final ClientLogger LOGGER = new ClientLogger(JdkHttpClientBuilder.class);

private static final Duration MINIMUM_TIMEOUT = Duration.ofMillis(1);
private static final Duration DEFAULT_CONNECTION_TIMEOUT;
private static final Duration DEFAULT_WRITE_TIMEOUT;
private static final Duration DEFAULT_RESPONSE_TIMEOUT;
private static final Duration DEFAULT_READ_TIMEOUT;

private static final String JAVA_HOME = System.getProperty("java.home");
private static final String JDK_HTTPCLIENT_ALLOW_RESTRICTED_HEADERS = "jdk.httpclient.allowRestrictedHeaders";

Expand All @@ -57,17 +51,6 @@ public class JdkHttpClientBuilder {
static final Set<String> DEFAULT_RESTRICTED_HEADERS;

static {
Configuration configuration = Configuration.getGlobalConfiguration();

DEFAULT_CONNECTION_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration,
PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT, Duration.ofSeconds(10), LOGGER);
DEFAULT_WRITE_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT,
Duration.ofSeconds(60), LOGGER);
DEFAULT_RESPONSE_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration,
PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT, Duration.ofSeconds(60), LOGGER);
DEFAULT_READ_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, PROPERTY_AZURE_REQUEST_READ_TIMEOUT,
Duration.ofSeconds(60), LOGGER);

DEFAULT_RESTRICTED_HEADERS = Set.of("connection", "content-length", "expect", "host", "upgrade");
}

Expand Down Expand Up @@ -248,11 +231,11 @@ public HttpClient build() {
// Azure JDK http client supports HTTP 1.1 by default.
httpClientBuilder.version(java.net.http.HttpClient.Version.HTTP_1_1);

httpClientBuilder = httpClientBuilder.connectTimeout(getTimeout(connectionTimeout, DEFAULT_CONNECTION_TIMEOUT));
httpClientBuilder = httpClientBuilder.connectTimeout(getTimeout(connectionTimeout, getDefaultConnectTimeout()));

Duration writeTimeout = getTimeout(this.writeTimeout, DEFAULT_WRITE_TIMEOUT);
Duration responseTimeout = getTimeout(this.responseTimeout, DEFAULT_RESPONSE_TIMEOUT);
Duration readTimeout = getTimeout(this.readTimeout, DEFAULT_READ_TIMEOUT);
Duration writeTimeout = getTimeout(this.writeTimeout, getDefaultWriteTimeout());
Duration responseTimeout = getTimeout(this.responseTimeout, getDefaultResponseTimeout());
Duration readTimeout = getTimeout(this.readTimeout, getDefaultReadTimeout());

Configuration buildConfiguration
= (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;
Expand Down Expand Up @@ -331,12 +314,4 @@ protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(this.userName, password.toCharArray());
}
}

private static Duration getTimeout(Duration configuredTimeout, Duration defaultTimeout) {
if (configuredTimeout == null) {
return defaultTimeout;
}

return configuredTimeout.compareTo(MINIMUM_TIMEOUT) < 0 ? MINIMUM_TIMEOUT : configuredTimeout;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.azure.core.http.HttpMethod;
import com.azure.core.implementation.util.HttpHeadersAccessHelper;
import com.azure.core.implementation.util.HttpUtils;
import com.azure.core.util.Context;
import com.azure.core.util.Contexts;
import com.azure.core.util.ProgressReporter;
Expand Down Expand Up @@ -51,6 +52,9 @@ public AzureJdkHttpRequest(com.azure.core.http.HttpRequest azureCoreRequest, Con
Set<String> restrictedHeaders, ClientLogger logger, Duration writeTimeout, Duration responseTimeout) {
HttpMethod method = azureCoreRequest.getHttpMethod();
ProgressReporter progressReporter = Contexts.with(context).getHttpRequestProgressReporter();
responseTimeout = (Duration) context.getData(HttpUtils.AZURE_RESPONSE_TIMEOUT)
.filter(timeoutDuration -> timeoutDuration instanceof Duration)
.orElse(responseTimeout);

this.method = method.toString();
this.bodyPublisher = (method == HttpMethod.GET || method == HttpMethod.HEAD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public final class JdkHttpClientLocalTestServer {
private static volatile LocalTestServer proxyServer;
private static final Semaphore PROXY_SERVER_SEMAPHORE = new Semaphore(1);

public static final String TIMEOUT = "/timeout";

public static final byte[] SHORT_BODY = "hi there".getBytes(StandardCharsets.UTF_8);
public static final byte[] LONG_BODY = createLongBody();

Expand Down Expand Up @@ -104,6 +106,16 @@ private static LocalTestServer initializeServer() {
resp.getHttpOutput().write(SHORT_BODY, 5, 3);
resp.getHttpOutput().flush();
resp.getHttpOutput().complete(Callback.NOOP);
} else if (get && TIMEOUT.equals(path)) {
try {
Thread.sleep(5000);
resp.setStatus(200);
resp.getHttpOutput().write(SHORT_BODY);
resp.getHttpOutput().flush();
resp.getHttpOutput().complete(Callback.NOOP);
} catch (InterruptedException e) {
throw new ServletException(e);
}
} else {
throw new ServletException("Unexpected request: " + req.getMethod() + " " + path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.azure.core.http.HttpMethod;
import com.azure.core.http.HttpRequest;
import com.azure.core.http.HttpResponse;
import com.azure.core.implementation.util.HttpUtils;
import com.azure.core.util.BinaryData;
import com.azure.core.util.Context;
import com.azure.core.util.Contexts;
Expand Down Expand Up @@ -55,6 +56,7 @@

import static com.azure.core.http.jdk.httpclient.JdkHttpClientLocalTestServer.LONG_BODY;
import static com.azure.core.http.jdk.httpclient.JdkHttpClientLocalTestServer.SHORT_BODY;
import static com.azure.core.http.jdk.httpclient.JdkHttpClientLocalTestServer.TIMEOUT;
import static com.azure.core.test.utils.TestUtils.assertArraysEqual;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
Expand Down Expand Up @@ -469,6 +471,46 @@ public void slowEagerReadingTimesOutAsync() {
.verify(Duration.ofSeconds(5));
}

@Test
public void perCallTimeout() {
HttpClient client = new JdkHttpClientBuilder().responseTimeout(Duration.ofSeconds(10)).build();

HttpRequest request = new HttpRequest(HttpMethod.GET, url(TIMEOUT));

// Verify a smaller timeout sent through Context times out the request.
StepVerifier.create(client.send(request, new Context(HttpUtils.AZURE_RESPONSE_TIMEOUT, Duration.ofSeconds(1))))
.expectErrorMatches(e -> e instanceof HttpTimeoutException)
.verify();

// Then verify not setting a timeout through Context does not time out the request.
StepVerifier.create(client.send(request)
.flatMap(response -> Mono.zip(FluxUtil.collectBytesInByteBufferStream(response.getBody()),
Mono.just(response.getStatusCode()))))
.assertNext(tuple -> {
assertArraysEqual(SHORT_BODY, tuple.getT1());
assertEquals(200, tuple.getT2());
})
.verifyComplete();
}

@Test
public void perCallTimeoutSync() {
HttpClient client = new JdkHttpClientBuilder().responseTimeout(Duration.ofSeconds(10)).build();

HttpRequest request = new HttpRequest(HttpMethod.GET, url(TIMEOUT));

// Verify a smaller timeout sent through Context times out the request.
RuntimeException ex = assertThrows(RuntimeException.class,
() -> client.sendSync(request, new Context(HttpUtils.AZURE_RESPONSE_TIMEOUT, Duration.ofSeconds(1))));
assertInstanceOf(HttpTimeoutException.class, ex.getCause());

// Then verify not setting a timeout through Context does not time out the request.
try (HttpResponse response = client.sendSync(request, Context.NONE)) {
assertEquals(200, response.getStatusCode());
assertArraysEqual(SHORT_BODY, response.getBodyAsBinaryData().toBytes());
}
}

private static Mono<HttpResponse> getResponse(String path) {
HttpClient client = new JdkHttpClientBuilder().build();
return doRequest(client, path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.azure.core.implementation.util.BinaryDataHelper;
import com.azure.core.implementation.util.ByteArrayContent;
import com.azure.core.implementation.util.FileContent;
import com.azure.core.implementation.util.HttpUtils;
import com.azure.core.implementation.util.InputStreamContent;
import com.azure.core.implementation.util.SerializableContent;
import com.azure.core.implementation.util.StringContent;
Expand Down Expand Up @@ -94,11 +95,6 @@ class NettyAsyncHttpClient implements HttpClient {
private static final ClientLogger LOGGER = new ClientLogger(NettyAsyncHttpClient.class);
private static final byte[] EMPTY_BYTES = new byte[0];

private static final String AZURE_EAGERLY_READ_RESPONSE = "azure-eagerly-read-response";
private static final String AZURE_IGNORE_RESPONSE_BODY = "azure-ignore-response-body";
private static final String AZURE_RESPONSE_TIMEOUT = "azure-response-timeout";
private static final String AZURE_EAGERLY_CONVERT_HEADERS = "azure-eagerly-convert-headers";

final boolean disableBufferCopy;

final boolean addProxyHandler;
Expand Down Expand Up @@ -132,10 +128,11 @@ public Mono<HttpResponse> send(HttpRequest request, Context context) {
Objects.requireNonNull(request.getUrl(), "'request.getUrl()' cannot be null.");
Objects.requireNonNull(request.getUrl().getProtocol(), "'request.getUrl().getProtocol()' cannot be null.");

boolean eagerlyReadResponse = (boolean) context.getData(AZURE_EAGERLY_READ_RESPONSE).orElse(false);
boolean ignoreResponseBody = (boolean) context.getData(AZURE_IGNORE_RESPONSE_BODY).orElse(false);
boolean headersEagerlyConverted = (boolean) context.getData(AZURE_EAGERLY_CONVERT_HEADERS).orElse(false);
Long responseTimeout = context.getData(AZURE_RESPONSE_TIMEOUT)
boolean eagerlyReadResponse = (boolean) context.getData(HttpUtils.AZURE_EAGERLY_READ_RESPONSE).orElse(false);
boolean ignoreResponseBody = (boolean) context.getData(HttpUtils.AZURE_IGNORE_RESPONSE_BODY).orElse(false);
boolean headersEagerlyConverted
= (boolean) context.getData(HttpUtils.AZURE_EAGERLY_CONVERT_HEADERS).orElse(false);
Long responseTimeout = context.getData(HttpUtils.AZURE_RESPONSE_TIMEOUT)
.filter(timeoutDuration -> timeoutDuration instanceof Duration)
.map(timeoutDuration -> ((Duration) timeoutDuration).toMillis())
.orElse(null);
Expand Down

0 comments on commit 52917f9

Please sign in to comment.