diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cefd75e..9101b10f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Version 2.8.0-beta1 - [Fix: Add `IJavaScriptSnippet` service interface and update the `IServiceCollection` extension to register it for `JavaScriptSnippet`.](https://github.com/microsoft/ApplicationInsights-aspnetcore/issues/890) +- [Make JavaScriptEncoder optional and Fallback to JavaScriptEncoder.Default.](https://github.com/microsoft/ApplicationInsights-aspnetcore/pull/918) + +## Version 2.7.1 - [Fix - ApplicationInsights StartupFilter should not swallow exceptions from downstream ApplicationBuilder.](https://github.com/microsoft/ApplicationInsights-aspnetcore/issues/897) ## Version 2.7.0 diff --git a/src/Microsoft.ApplicationInsights.AspNetCore/JavaScriptSnippet.cs b/src/Microsoft.ApplicationInsights.AspNetCore/JavaScriptSnippet.cs index f394d8f7..ee45d207 100644 --- a/src/Microsoft.ApplicationInsights.AspNetCore/JavaScriptSnippet.cs +++ b/src/Microsoft.ApplicationInsights.AspNetCore/JavaScriptSnippet.cs @@ -41,12 +41,12 @@ public JavaScriptSnippet( TelemetryConfiguration telemetryConfiguration, IOptions serviceOptions, IHttpContextAccessor httpContextAccessor, - JavaScriptEncoder encoder) + JavaScriptEncoder encoder = null) { this.telemetryConfiguration = telemetryConfiguration; this.httpContextAccessor = httpContextAccessor; this.enableAuthSnippet = serviceOptions.Value.EnableAuthenticationTrackingJavaScript; - this.encoder = encoder; + this.encoder = (encoder == null) ? JavaScriptEncoder.Default : encoder; } ///