Skip to content

Commit 8a5cad2

Browse files
authored
Merge pull request #148 from kedrzu/master
Support for IHttpContextAccessor in ParallelApplicationPipelinesExtensions
2 parents 6f65819 + b778c61 commit 8a5cad2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/WebApiContrib.Core/ParallelApplicationPipelinesExtensions.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ public static IApplicationBuilder UseBranchWithServices(this IApplicationBuilder
3737
using (var scope = factory.CreateScope())
3838
{
3939
context.RequestServices = scope.ServiceProvider;
40+
41+
var httpContextAccessor = context.RequestServices
42+
.GetService<IHttpContextAccessor>();
43+
44+
if (httpContextAccessor != null)
45+
httpContextAccessor.HttpContext = context;
46+
4047
await next();
4148
}
4249
});

0 commit comments

Comments
 (0)