Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
30c39e1
SortsQueryParams
mrm9084 Sep 11, 2025
2a863f2
Update CHANGELOG.md
mrm9084 Sep 11, 2025
c6e085f
Update QueryParamPolicy.java
mrm9084 Sep 11, 2025
1c451cf
Fixing tags
mrm9084 Sep 12, 2025
cd062ee
Style fixes
mrm9084 Sep 12, 2025
edbecab
Update QueryParamPolicyTest.java
mrm9084 Sep 12, 2025
858ae3c
Update QueryParamPolicyTest.java
mrm9084 Sep 12, 2025
387731f
Update QueryParamPolicyTest.java
mrm9084 Sep 12, 2025
d73ca61
Update assets.json
mrm9084 Oct 9, 2025
0efdeb4
review items
mrm9084 Oct 9, 2025
e0d02bb
Merge branch 'main' into QueryParamaterPipeline
mrm9084 Oct 9, 2025
404b483
Update QueryParamPolicy.java
mrm9084 Oct 9, 2025
7193a4a
Merge branch 'QueryParamaterPipeline' of https://github.com/mrm9084/a…
mrm9084 Oct 9, 2025
3cbc14e
Update QueryParamPolicy.java
mrm9084 Oct 13, 2025
aa6a387
Update QueryParamPolicy.java
mrm9084 Oct 13, 2025
267caf3
Update QueryParamPolicy.java
mrm9084 Oct 13, 2025
e1907f1
Updating assets.json for azure-monitor-query
jairmyree Oct 22, 2025
dd05f82
updating test files to use TME subscription
jairmyree Oct 22, 2025
b1570ec
Updating assets.json for azure-monitor-query-metrics
jairmyree Oct 27, 2025
5d43d7b
Changing monitor app-config dependency to current to pull new changes
jairmyree Oct 27, 2025
3255ca4
Changing monitor app-config dependencies
jairmyree Oct 27, 2025
110b832
updating assets.json
jairmyree Oct 27, 2025
5595677
Merge branch 'main' into QueryParamaterPipeline
jairmyree Oct 27, 2025
18dd52e
Changing monitor dependency to unreleased app config
jairmyree Oct 30, 2025
f1e8dd6
Merge branch 'main' into QueryParamaterPipeline
jairmyree Oct 30, 2025
6a1e309
Updating assets.json files
jairmyree Oct 31, 2025
6e20621
updated pom and assets.json
jairmyree Oct 31, 2025
94139bc
Update QueryParamPolicyTest.java
mrm9084 Nov 3, 2025
e393d1f
Merge branch 'main' into QueryParamaterPipeline
mrm9084 Nov 3, 2025
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
1 change: 1 addition & 0 deletions eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ io.clientcore:optional-dependency-tests;1.0.0-beta.1;1.0.0-beta.1
# In the pom, the version update tag after the version should name the unreleased package and the dependency version:
# <!-- {x-version-update;unreleased_com.azure:azure-core;dependency} -->

unreleased_com.azure:azure-data-appconfiguration;1.9.0-beta.1
unreleased_com.azure.v2:azure-core;2.0.0-beta.1
unreleased_com.azure.v2:azure-identity;2.0.0-beta.1
unreleased_com.azure.v2:azure-data-appconfiguration;2.0.0-beta.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.9.0-beta.1 (Unreleased)

### Features Added
- Added a pipeline policy to handle query parameters to make sure the keys are always in lower case and in alphabetical order.

### Breaking Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/appconfiguration/azure-data-appconfiguration",
"Tag": "java/appconfiguration/azure-data-appconfiguration_5e00bac278"
"Tag": "java/appconfiguration/azure-data-appconfiguration_90b5086be3"
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import com.azure.data.appconfiguration.implementation.AzureAppConfigurationImpl;
import com.azure.data.appconfiguration.implementation.ConfigurationClientCredentials;
import com.azure.data.appconfiguration.implementation.ConfigurationCredentialsPolicy;
import com.azure.data.appconfiguration.implementation.QueryParamPolicy;
import com.azure.data.appconfiguration.implementation.SyncTokenPolicy;
import com.azure.data.appconfiguration.models.ConfigurationAudience;

Expand Down Expand Up @@ -263,6 +264,9 @@ private HttpPipeline createDefaultHttpPipeline(SyncTokenPolicy syncTokenPolicy,
policies.add(new AddHeadersFromContextPolicy());
policies.add(ADD_HEADERS_POLICY);

// Add query parameter reordering policy
policies.add(new QueryParamPolicy());

policies.addAll(perCallPolicies);
HttpPolicyProviders.addBeforeRetryPolicies(policies);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.data.appconfiguration.implementation;

import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import com.azure.core.http.HttpPipelineCallContext;
import com.azure.core.http.HttpRequest;
import com.azure.core.http.policy.HttpPipelineSyncPolicy;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.UrlBuilder;
import com.azure.core.util.logging.ClientLogger;

public final class QueryParamPolicy extends HttpPipelineSyncPolicy {
private static final ClientLogger LOGGER = new ClientLogger(QueryParamPolicy.class);

@Override
protected void beforeSendingRequest(HttpPipelineCallContext context) {
HttpRequest httpRequest = context.getHttpRequest();

try {
UrlBuilder builder = UrlBuilder.parse(httpRequest.getUrl());
String queryString = builder.getQueryString();
builder.clearQuery();
TreeMap<String, List<String>> orderedQuery = new TreeMap<>(String::compareTo);
CoreUtils.parseQueryParameters(queryString).forEachRemaining(kvp -> {
String lowercaseKey = kvp.getKey().toLowerCase();
orderedQuery.compute(lowercaseKey, (ignored, values) -> {
if (values == null) {
values = new ArrayList<>();
}
values.add(kvp.getValue());
return values;
});
});
for (Map.Entry<String, List<String>> ordered : orderedQuery.entrySet()) {
// Sort values for each parameter key to ensure consistent ordering
ordered.getValue().sort(String::compareTo);
for (String val : ordered.getValue()) {
builder.addQueryParameter(ordered.getKey(), val);
}
}
httpRequest.setUrl(builder.toUrl().toString());
} catch (IllegalArgumentException | MalformedURLException e) {
// If the constructed URL is invalid when setting it, continue without modification
LOGGER.warning(
"Failed to set normalized URL due to invalid format. "
+ "Request will proceed with original URL. URL: {}, Error: {}",
httpRequest.getUrl(), e.getMessage(), e);
}
}

}
Loading