Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit 9bf94d3

Browse files
authored
Remove unused parameter in ctor of HttpContextFactory (#881)
- We removed the use of the ObjectPoolProvider in 1.x, this change just removes it from the ctor.
1 parent 163836f commit 9bf94d3

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

src/Microsoft.AspNetCore.Http/HttpContextFactory.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System;
55
using Microsoft.AspNetCore.Http.Features;
6-
using Microsoft.Extensions.ObjectPool;
76
using Microsoft.Extensions.Options;
87

98
namespace Microsoft.AspNetCore.Http
@@ -13,17 +12,13 @@ public class HttpContextFactory : IHttpContextFactory
1312
private readonly IHttpContextAccessor _httpContextAccessor;
1413
private readonly FormOptions _formOptions;
1514

16-
public HttpContextFactory(ObjectPoolProvider poolProvider, IOptions<FormOptions> formOptions)
17-
: this(poolProvider, formOptions, httpContextAccessor: null)
15+
public HttpContextFactory(IOptions<FormOptions> formOptions)
16+
: this(formOptions, httpContextAccessor: null)
1817
{
1918
}
2019

21-
public HttpContextFactory(ObjectPoolProvider poolProvider, IOptions<FormOptions> formOptions, IHttpContextAccessor httpContextAccessor)
20+
public HttpContextFactory(IOptions<FormOptions> formOptions, IHttpContextAccessor httpContextAccessor)
2221
{
23-
if (poolProvider == null)
24-
{
25-
throw new ArgumentNullException(nameof(poolProvider));
26-
}
2722
if (formOptions == null)
2823
{
2924
throw new ArgumentNullException(nameof(formOptions));
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"TypeId": "public class Microsoft.AspNetCore.Http.HttpContextFactory : Microsoft.AspNetCore.Http.IHttpContextFactory",
4+
"MemberId": "public .ctor(Microsoft.Extensions.ObjectPool.ObjectPoolProvider poolProvider, Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Http.Features.FormOptions> formOptions)",
5+
"Kind": "Removal"
6+
},
7+
{
8+
"TypeId": "public class Microsoft.AspNetCore.Http.HttpContextFactory : Microsoft.AspNetCore.Http.IHttpContextFactory",
9+
"MemberId": "public .ctor(Microsoft.Extensions.ObjectPool.ObjectPoolProvider poolProvider, Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Http.Features.FormOptions> formOptions, Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor)",
10+
"Kind": "Removal"
11+
}
12+
]

test/Microsoft.AspNetCore.Http.Tests/HttpContextFactoryTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System;
55
using System.IO;
66
using Microsoft.AspNetCore.Http.Features;
7-
using Microsoft.Extensions.ObjectPool;
87
using Microsoft.Extensions.Options;
98
using Xunit;
109

@@ -17,7 +16,7 @@ public void CreateHttpContextSetsHttpContextAccessor()
1716
{
1817
// Arrange
1918
var accessor = new HttpContextAccessor();
20-
var contextFactory = new HttpContextFactory(new DefaultObjectPoolProvider(), Options.Create(new FormOptions()), accessor);
19+
var contextFactory = new HttpContextFactory(Options.Create(new FormOptions()), accessor);
2120

2221
// Act
2322
var context = contextFactory.Create(new FeatureCollection());
@@ -30,7 +29,7 @@ public void CreateHttpContextSetsHttpContextAccessor()
3029
public void AllowsCreatingContextWithoutSettingAccessor()
3130
{
3231
// Arrange
33-
var contextFactory = new HttpContextFactory(new DefaultObjectPoolProvider(), Options.Create(new FormOptions()));
32+
var contextFactory = new HttpContextFactory(Options.Create(new FormOptions()));
3433

3534
// Act & Assert
3635
var context = contextFactory.Create(new FeatureCollection());

0 commit comments

Comments
 (0)