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

Remove unused parameter in ctor of HttpContextFactory #881

Merged
merged 1 commit into from
Jun 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/Microsoft.AspNetCore.Http/HttpContextFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.ObjectPool;
using Microsoft.Extensions.Options;

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

public HttpContextFactory(ObjectPoolProvider poolProvider, IOptions<FormOptions> formOptions)
: this(poolProvider, formOptions, httpContextAccessor: null)
public HttpContextFactory(IOptions<FormOptions> formOptions)
: this(formOptions, httpContextAccessor: null)
{
}

public HttpContextFactory(ObjectPoolProvider poolProvider, IOptions<FormOptions> formOptions, IHttpContextAccessor httpContextAccessor)
public HttpContextFactory(IOptions<FormOptions> formOptions, IHttpContextAccessor httpContextAccessor)
{
if (poolProvider == null)
{
throw new ArgumentNullException(nameof(poolProvider));
}
if (formOptions == null)
{
throw new ArgumentNullException(nameof(formOptions));
Expand Down
12 changes: 12 additions & 0 deletions src/Microsoft.AspNetCore.Http/breakingchanges.netcore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
 [
{
"TypeId": "public class Microsoft.AspNetCore.Http.HttpContextFactory : Microsoft.AspNetCore.Http.IHttpContextFactory",
"MemberId": "public .ctor(Microsoft.Extensions.ObjectPool.ObjectPoolProvider poolProvider, Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Http.Features.FormOptions> formOptions)",
"Kind": "Removal"
},
{
"TypeId": "public class Microsoft.AspNetCore.Http.HttpContextFactory : Microsoft.AspNetCore.Http.IHttpContextFactory",
"MemberId": "public .ctor(Microsoft.Extensions.ObjectPool.ObjectPoolProvider poolProvider, Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Http.Features.FormOptions> formOptions, Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor)",
"Kind": "Removal"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.IO;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.ObjectPool;
using Microsoft.Extensions.Options;
using Xunit;

Expand All @@ -17,7 +16,7 @@ public void CreateHttpContextSetsHttpContextAccessor()
{
// Arrange
var accessor = new HttpContextAccessor();
var contextFactory = new HttpContextFactory(new DefaultObjectPoolProvider(), Options.Create(new FormOptions()), accessor);
var contextFactory = new HttpContextFactory(Options.Create(new FormOptions()), accessor);

// Act
var context = contextFactory.Create(new FeatureCollection());
Expand All @@ -30,7 +29,7 @@ public void CreateHttpContextSetsHttpContextAccessor()
public void AllowsCreatingContextWithoutSettingAccessor()
{
// Arrange
var contextFactory = new HttpContextFactory(new DefaultObjectPoolProvider(), Options.Create(new FormOptions()));
var contextFactory = new HttpContextFactory(Options.Create(new FormOptions()));

// Act & Assert
var context = contextFactory.Create(new FeatureCollection());
Expand Down