public void ApiVersionIsNotSanitizedByDefault() { HttpMessageSanitizer sanitizer = ClientDiagnostics.CreateMessageSanitizer(ClientOptions.Default.Diagnostics); var uriBuilder = new RequestUriBuilder(); uriBuilder.Reset(new Uri("http://localhost/")); uriBuilder.AppendQuery("api-version", "2021-11-01"); Assert.AreEqual("http://localhost/?api-version=2021-11-01", sanitizer.SanitizeUrl(uriBuilder.ToString())); }
public void CanRemoveApiVersionFromLoggedQueryParams() { var options = new DefaultClientOptions(); options.Diagnostics.LoggedQueryParameters.Remove("api-version"); HttpMessageSanitizer sanitizer = ClientDiagnostics.CreateMessageSanitizer(options.Diagnostics); var uriBuilder = new RequestUriBuilder(); uriBuilder.Reset(new Uri("http://localhost/")); uriBuilder.AppendQuery("api-version", "2021-11-01"); Assert.AreEqual("http://localhost/?api-version=REDACTED", sanitizer.SanitizeUrl(uriBuilder.ToString())); }