@@ -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