@@ -98,26 +98,11 @@ export async function loadFromCdn(
98
98
getToken : async ( ) => ( { token : "" , expiresOnTimestamp : 0 } )
99
99
} ;
100
100
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
- } ;
113
101
if ( appConfigOptions === undefined ) {
114
102
appConfigOptions = { clientOptions : { } } ;
115
103
}
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" } ;
121
106
122
107
return await load ( cdnEndpoint , emptyTokenCredential , appConfigOptions ) ;
123
108
}
0 commit comments