Skip to content

Commit 04d8a2c

Browse files
update
1 parent 197db89 commit 04d8a2c

File tree

3 files changed

+30
-23
lines changed

3 files changed

+30
-23
lines changed

package-lock.json

Lines changed: 27 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"uuid": "^9.0.1"
5656
},
5757
"dependencies": {
58-
"@azure/app-configuration": "^1.6.1",
58+
"@azure/app-configuration": "^1.8.0",
5959
"@azure/identity": "^4.2.1",
6060
"@azure/keyvault-secrets": "^4.7.0"
6161
}

src/load.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,26 +98,11 @@ export async function loadFromCdn(
9898
getToken: async () => ({ token: "", expiresOnTimestamp: 0 })
9999
};
100100

101-
// the api version supports sas token authentication
102-
const apiVersion = "2024-09-01-preview";
103-
const policyName = "CdnRequestApiVersionPolicy";
104-
const apiVersionPolicy: PipelinePolicy = {
105-
name: policyName,
106-
sendRequest: async (request: PipelineRequest, next: SendRequest) => {
107-
const url = new URL(request.url);
108-
url.searchParams.set("api-version", apiVersion);
109-
request.url = url.toString();
110-
return next(request);
111-
},
112-
};
113101
if (appConfigOptions === undefined) {
114102
appConfigOptions = { clientOptions: {}};
115103
}
116-
const policies = appConfigOptions.clientOptions?.additionalPolicies || [];
117-
// The policy position should be perRetry so that the policy will be processed after the api version policy added by the SDK.
118-
// https://learn.microsoft.com/en-us/dotnet/api/azure.core.httppipelineposition?view=azure-dotnet#fields
119-
policies.push({policy: apiVersionPolicy, position: "perRetry"});
120-
appConfigOptions.clientOptions = { ...appConfigOptions.clientOptions, additionalPolicies: policies};
104+
// Specify the api version that supports sas token authentication
105+
appConfigOptions.clientOptions = { ...appConfigOptions.clientOptions, apiVersion: "2024-09-01-preview"};
121106

122107
return await load(cdnEndpoint, emptyTokenCredential, appConfigOptions);
123108
}

0 commit comments

Comments
 (0)