React to string[] -> StringValues changes.

This commit is contained in:
Chris R 2015-08-28 14:23:17 -07:00
parent 2a7dcea266
commit 7bb59a287c
2 changed files with 17 additions and 22 deletions

View File

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

View File

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