Fix breaks from GetFormAsync, IReadableStringCollection.Keys.
This commit is contained in:
parent
e6ec6e0aba
commit
1d3e6b0dd0
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
|||
if (IsSupportedContentType(request))
|
||||
{
|
||||
var culture = GetCultureInfo(request);
|
||||
return new ReadableStringCollectionValueProvider(request.GetFormAsync, culture);
|
||||
return new ReadableStringCollectionValueProvider(() => request.GetFormAsync(), culture);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -96,10 +96,8 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
|||
if (_prefixContainer == null)
|
||||
{
|
||||
// Initialization race is OK providing data remains read-only and object identity is not significant
|
||||
// TODO: Fix this once https://github.com/aspnet/HttpAbstractions/issues/3 is sorted out.
|
||||
|
||||
var collection = await GetValueCollectionAsync();
|
||||
_prefixContainer = new PrefixContainer(collection.Select(v => v.Key).ToArray());
|
||||
_prefixContainer = new PrefixContainer(collection.Keys);
|
||||
}
|
||||
return _prefixContainer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Moq;
|
||||
|
|
@ -125,7 +126,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test
|
|||
var requestContext = new Mock<HttpRequest>();
|
||||
IReadableStringCollection formsCollection =
|
||||
new MockCookieCollection(new Dictionary<string, string>() { { "form-field-name", string.Empty } });
|
||||
requestContext.Setup(o => o.GetFormAsync())
|
||||
requestContext.Setup(o => o.GetFormAsync(CancellationToken.None))
|
||||
.Returns(Task.FromResult(formsCollection));
|
||||
mockHttpContext.Setup(o => o.Request)
|
||||
.Returns(requestContext.Object);
|
||||
|
|
@ -154,7 +155,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test
|
|||
new MockCookieCollection(new Dictionary<string, string>() { { "form-field-name", "invalid-value" } });
|
||||
|
||||
var requestContext = new Mock<HttpRequest>();
|
||||
requestContext.Setup(o => o.GetFormAsync())
|
||||
requestContext.Setup(o => o.GetFormAsync(CancellationToken.None))
|
||||
.Returns(Task.FromResult(formsCollection));
|
||||
|
||||
var mockHttpContext = new Mock<HttpContext>();
|
||||
|
|
@ -194,7 +195,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test
|
|||
var requestContext = new Mock<HttpRequest>();
|
||||
IReadableStringCollection formsCollection =
|
||||
new MockCookieCollection(new Dictionary<string, string>() { { "form-field-name", "valid-value" } });
|
||||
requestContext.Setup(o => o.GetFormAsync())
|
||||
requestContext.Setup(o => o.GetFormAsync(CancellationToken.None))
|
||||
.Returns(Task.FromResult(formsCollection));
|
||||
mockHttpContext.Setup(o => o.Request)
|
||||
.Returns(requestContext.Object);
|
||||
|
|
|
|||
Loading…
Reference in New Issue