Skip to content

Commit 685f7da

Browse files
Revert "Clean up how IHttpContextAccessor is added" because this API
only exists in 2.1.x, and this branch is for 2.0.1 This reverts commit e583a17.
1 parent e6309ba commit 685f7da

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Microsoft.AspNetCore.SpaServices/Prerendering/PrerenderingServiceCollectionExtensions.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
using Microsoft.AspNetCore.SpaServices.Prerendering;
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using Microsoft.AspNetCore.Http;
5+
using Microsoft.AspNetCore.NodeServices;
6+
using Microsoft.AspNetCore.SpaServices.Prerendering;
7+
using Microsoft.Extensions.DependencyInjection.Extensions;
28

39
namespace Microsoft.Extensions.DependencyInjection
410
{
@@ -14,7 +20,7 @@ public static class PrerenderingServiceCollectionExtensions
1420
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
1521
public static void AddSpaPrerenderer(this IServiceCollection serviceCollection)
1622
{
17-
serviceCollection.AddHttpContextAccessor();
23+
serviceCollection.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
1824
serviceCollection.AddSingleton<ISpaPrerenderer, DefaultSpaPrerenderer>();
1925
}
2026
}

0 commit comments

Comments
 (0)