File tree Expand file tree Collapse file tree 2 files changed +3
-22
lines changed
sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure Expand file tree Collapse file tree 2 files changed +3
-22
lines changed Original file line number Diff line number Diff line change @@ -12,28 +12,9 @@ public PersonalizerRecordedTestSanitizer() : base()
1212 {
1313 AddJsonPathSanitizer ( "$..accessToken" ) ;
1414 AddJsonPathSanitizer ( "$..source" ) ;
15+ SanitizedHeaders . Add ( "Ocp-Apim-Subscription-Key" ) ;
1516 // TODO: Remove when re-recording
1617 LegacyConvertJsonDateTokens = true ;
1718 }
18-
19- public override void SanitizeHeaders ( IDictionary < string , string [ ] > headers )
20- {
21- if ( headers . ContainsKey ( "Ocp-Apim-Subscription-Key" ) )
22- {
23- headers [ "Ocp-Apim-Subscription-Key" ] = new [ ] { SanitizeValue } ;
24- }
25-
26- base . SanitizeHeaders ( headers ) ;
27- }
28-
29- public override string SanitizeVariable ( string variableName , string environmentVariableValue )
30- {
31- return variableName switch
32- {
33- PersonalizerTestEnvironment . MultiSlotApiKeyEnvironmentVariableName => SanitizeValue ,
34- PersonalizerTestEnvironment . SingleSlotApiKeyEnvironmentVariableName => SanitizeValue ,
35- _ => base . SanitizeVariable ( variableName , environmentVariableValue )
36- } ;
37- }
3819 }
3920}
Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ public class PersonalizerTestEnvironment: TestEnvironment
1919 /// <summary>The name of the environment variable from which the Personalizer resource's API key will be extracted for the live tests.</summary>
2020 internal const string SingleSlotApiKeyEnvironmentVariableName = "PERSONALIZER_API_KEY_SINGLE_SLOT" ;
2121
22- public string SingleSlotApiKey => GetRecordedVariable ( SingleSlotApiKeyEnvironmentVariableName ) ;
22+ public string SingleSlotApiKey => GetRecordedVariable ( SingleSlotApiKeyEnvironmentVariableName , options => options . IsSecret ( ) ) ;
2323 public string SingleSlotEndpoint => GetRecordedVariable ( SingleSlotEndpointEnvironmentVariableName ) ;
2424
25- public string MultiSlotApiKey => GetRecordedVariable ( MultiSlotApiKeyEnvironmentVariableName ) ;
25+ public string MultiSlotApiKey => GetRecordedVariable ( MultiSlotApiKeyEnvironmentVariableName , options => options . IsSecret ( ) ) ;
2626 public string MultiSlotEndpoint => GetRecordedVariable ( MultiSlotEndpointEnvironmentVariableName ) ;
2727 }
2828}
You can’t perform that action at this time.
0 commit comments