#310 Do not automatically wrap IFeatureCollections.
This commit is contained in:
parent
7441855c34
commit
f88b206082
|
|
@ -11,7 +11,7 @@ namespace Microsoft.AspNet.Hosting.Builder
|
|||
{
|
||||
public HttpContext CreateHttpContext(IFeatureCollection featureCollection)
|
||||
{
|
||||
return new DefaultHttpContext(new FeatureCollection(featureCollection));
|
||||
return new DefaultHttpContext(featureCollection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -308,29 +308,6 @@ namespace Microsoft.AspNet.Hosting
|
|||
Assert.IsType<FastHttpRequestIdentifierFeature>(httpContext.Features.Get<IHttpRequestIdentifierFeature>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Hosting_CreatesDefaultRequestIdentifierFeature_IfNotPresent_ForImmutableFeatureCollection()
|
||||
{
|
||||
// Arrange
|
||||
HttpContext httpContext = null;
|
||||
var requestDelegate = new RequestDelegate(innerHttpContext =>
|
||||
{
|
||||
httpContext = innerHttpContext;
|
||||
return Task.FromResult(0);
|
||||
});
|
||||
|
||||
_featuresSupportedByThisHost = new ReadOnlyFeatureCollection();
|
||||
|
||||
var hostingEngine = CreateHostingEngine(requestDelegate);
|
||||
|
||||
// Act
|
||||
var disposable = hostingEngine.Start();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(httpContext);
|
||||
Assert.IsType<FastHttpRequestIdentifierFeature>(httpContext.Features.Get<IHttpRequestIdentifierFeature>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HostingEngine_DoesNot_CreateDefaultRequestIdentifierFeature_IfPresent()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Microsoft.AspNet.Hosting.Tests
|
|||
{
|
||||
var env = new Dictionary<string, object>();
|
||||
var contextFactory = new HttpContextFactory();
|
||||
var context = contextFactory.CreateHttpContext(new OwinFeatureCollection(env));
|
||||
var context = contextFactory.CreateHttpContext(new FeatureCollection(new OwinFeatureCollection(env)));
|
||||
|
||||
// Setting a feature will throw if the above feature collection is not wrapped in a mutable feature collection.
|
||||
context.Features.Set<ICustomFeature>(new CustomFeature(100));
|
||||
|
|
|
|||
Loading…
Reference in New Issue