Skip to content

Commit f88b206

Browse files
committed
#310 Do not automatically wrap IFeatureCollections.
1 parent 7441855 commit f88b206

File tree

3 files changed

+2
-25
lines changed

3 files changed

+2
-25
lines changed

src/Microsoft.AspNet.Hosting/Builder/HttpContextFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class HttpContextFactory : IHttpContextFactory
1111
{
1212
public HttpContext CreateHttpContext(IFeatureCollection featureCollection)
1313
{
14-
return new DefaultHttpContext(new FeatureCollection(featureCollection));
14+
return new DefaultHttpContext(featureCollection);
1515
}
1616
}
1717
}

test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -308,29 +308,6 @@ public void HostingEngine_CreatesDefaultRequestIdentifierFeature_IfNotPresent()
308308
Assert.IsType<FastHttpRequestIdentifierFeature>(httpContext.Features.Get<IHttpRequestIdentifierFeature>());
309309
}
310310

311-
[Fact]
312-
public void Hosting_CreatesDefaultRequestIdentifierFeature_IfNotPresent_ForImmutableFeatureCollection()
313-
{
314-
// Arrange
315-
HttpContext httpContext = null;
316-
var requestDelegate = new RequestDelegate(innerHttpContext =>
317-
{
318-
httpContext = innerHttpContext;
319-
return Task.FromResult(0);
320-
});
321-
322-
_featuresSupportedByThisHost = new ReadOnlyFeatureCollection();
323-
324-
var hostingEngine = CreateHostingEngine(requestDelegate);
325-
326-
// Act
327-
var disposable = hostingEngine.Start();
328-
329-
// Assert
330-
Assert.NotNull(httpContext);
331-
Assert.IsType<FastHttpRequestIdentifierFeature>(httpContext.Features.Get<IHttpRequestIdentifierFeature>());
332-
}
333-
334311
[Fact]
335312
public void HostingEngine_DoesNot_CreateDefaultRequestIdentifierFeature_IfPresent()
336313
{

test/Microsoft.AspNet.Hosting.Tests/HttpContextFactoryFacts.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public void Mutable_FeatureCollection_Wrapped_For_OwinFeatureCollection()
1616
{
1717
var env = new Dictionary<string, object>();
1818
var contextFactory = new HttpContextFactory();
19-
var context = contextFactory.CreateHttpContext(new OwinFeatureCollection(env));
19+
var context = contextFactory.CreateHttpContext(new FeatureCollection(new OwinFeatureCollection(env)));
2020

2121
// Setting a feature will throw if the above feature collection is not wrapped in a mutable feature collection.
2222
context.Features.Set<ICustomFeature>(new CustomFeature(100));

0 commit comments

Comments
 (0)