React to string[] -> StringValues changes.

This commit is contained in:
Chris R 2015-08-28 14:23:17 -07:00
Родитель 2a7dcea266
Коммит 7bb59a287c
2 изменённых файлов: 17 добавлений и 22 удалений

Просмотреть файл

@ -149,7 +149,7 @@ namespace Microsoft.AspNet.Antiforgery
// Adding X-Frame-Options header to prevent ClickJacking. See
// http://tools.ietf.org/html/draft-ietf-websec-x-frame-options-10
// for more information.
context.Response.Headers.Set("X-Frame-Options", "SAMEORIGIN");
context.Response.Headers["X-Frame-Options"] = "SAMEORIGIN";
}
}

Просмотреть файл

@ -4,11 +4,11 @@
#if DNX451
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Internal;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Primitives;
using Moq;
using Xunit;
@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Antiforgery
// Arrange
var requestCookies = new Mock<IReadableStringCollection>();
requestCookies
.Setup(o => o.Get(It.IsAny<string>()))
.Setup(o => o[It.IsAny<string>()])
.Returns(string.Empty);
var mockHttpContext = new Mock<HttpContext>();
mockHttpContext
@ -55,7 +55,7 @@ namespace Microsoft.AspNet.Antiforgery
// Arrange
var requestCookies = new Mock<IReadableStringCollection>();
requestCookies
.Setup(o => o.Get(It.IsAny<string>()))
.Setup(o => o[It.IsAny<string>()])
.Returns(string.Empty);
var mockHttpContext = new Mock<HttpContext>();
mockHttpContext
@ -165,8 +165,8 @@ namespace Microsoft.AspNet.Antiforgery
{
// Arrange
var httpContext = new DefaultHttpContext();
httpContext.Request.Form = new FormCollection(new Dictionary<string, string[]>());
httpContext.Request.Cookies = new ReadableStringCollection(new Dictionary<string, string[]>());
httpContext.Request.Form = new FormCollection(new Dictionary<string, StringValues>());
httpContext.Request.Cookies = new ReadableStringCollection(new Dictionary<string, StringValues>());
var options = new AntiforgeryOptions()
{
@ -195,9 +195,9 @@ namespace Microsoft.AspNet.Antiforgery
// Will not be accessed
httpContext.Request.Form = null;
httpContext.Request.Cookies = new ReadableStringCollection(new Dictionary<string, string[]>()
httpContext.Request.Cookies = new ReadableStringCollection(new Dictionary<string, StringValues>()
{
{ "cookie-name", new string[] { "cookie-value" } },
{ "cookie-name", "cookie-value" },
});
var options = new AntiforgeryOptions()
@ -224,10 +224,10 @@ namespace Microsoft.AspNet.Antiforgery
// Arrange
var httpContext = new DefaultHttpContext();
httpContext.Request.ContentType = "application/x-www-form-urlencoded";
httpContext.Request.Form = new FormCollection(new Dictionary<string, string[]>());
httpContext.Request.Cookies = new ReadableStringCollection(new Dictionary<string, string[]>()
httpContext.Request.Form = new FormCollection(new Dictionary<string, StringValues>());
httpContext.Request.Cookies = new ReadableStringCollection(new Dictionary<string, StringValues>()
{
{ "cookie-name", new string[] { "cookie-value" } },
{ "cookie-name", "cookie-value" },
});
var options = new AntiforgeryOptions()
@ -254,13 +254,13 @@ namespace Microsoft.AspNet.Antiforgery
// Arrange
var httpContext = new DefaultHttpContext();
httpContext.Request.ContentType = "application/x-www-form-urlencoded";
httpContext.Request.Form = new FormCollection(new Dictionary<string, string[]>()
httpContext.Request.Form = new FormCollection(new Dictionary<string, StringValues>()
{
{ "form-field-name", new string[] { "form-value" } },
{ "form-field-name", "form-value" },
});
httpContext.Request.Cookies = new ReadableStringCollection(new Dictionary<string, string[]>()
httpContext.Request.Cookies = new ReadableStringCollection(new Dictionary<string, StringValues>()
{
{ "cookie-name", new string[] { "cookie-value" } },
{ "cookie-name", "cookie-value" },
});
var options = new AntiforgeryOptions()
@ -419,22 +419,17 @@ namespace Microsoft.AspNet.Antiforgery
return this[key];
}
public IList<string> GetValues(string key)
{
throw new NotImplementedException();
}
public bool ContainsKey(string key)
{
return _dictionary.ContainsKey(key);
}
public string this[string key]
public StringValues this[string key]
{
get { return _dictionary[key]; }
}
public IEnumerator<KeyValuePair<string, string[]>> GetEnumerator()
public IEnumerator<KeyValuePair<string, StringValues>> GetEnumerator()
{
throw new NotImplementedException();
}