React to string[] -> StringValues changes.

This commit is contained in:
Chris R 2015-08-28 12:27:17 -07:00
parent 28268ee64b
commit d448c6e389
3 changed files with 11 additions and 8 deletions

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.IO;
@ -135,14 +136,14 @@ namespace Microsoft.AspNet.TestHost
foreach (var header in request.Headers)
{
serverRequest.Headers.AppendValues(header.Key, header.Value.ToArray());
serverRequest.Headers.Append(header.Key, header.Value.ToArray());
}
var requestContent = request.Content;
if (requestContent != null)
{
foreach (var header in request.Content.Headers)
{
serverRequest.Headers.AppendValues(header.Key, header.Value.ToArray());
serverRequest.Headers.Append(header.Key, header.Value.ToArray());
}
}
@ -187,9 +188,9 @@ namespace Microsoft.AspNet.TestHost
foreach (var header in HttpContext.Response.Headers)
{
if (!response.Headers.TryAddWithoutValidation(header.Key, header.Value))
if (!response.Headers.TryAddWithoutValidation(header.Key, (IEnumerable<string>)header.Value))
{
bool success = response.Content.Headers.TryAddWithoutValidation(header.Key, header.Value);
bool success = response.Content.Headers.TryAddWithoutValidation(header.Key, (IEnumerable<string>)header.Value);
Contract.Assert(success, "Bad header");
}
}

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.AspNet.Http.Features;
using Microsoft.Framework.Primitives;
namespace Microsoft.AspNet.TestHost
{
@ -13,7 +14,7 @@ namespace Microsoft.AspNet.TestHost
public RequestFeature()
{
Body = Stream.Null;
Headers = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase);
Headers = new Dictionary<string, StringValues>(StringComparer.OrdinalIgnoreCase);
Method = "GET";
Path = "";
PathBase = "";
@ -24,7 +25,7 @@ namespace Microsoft.AspNet.TestHost
public Stream Body { get; set; }
public IDictionary<string, string[]> Headers { get; set; }
public IDictionary<string, StringValues> Headers { get; set; }
public string Method { get; set; }

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNet.Http.Features;
using Microsoft.Framework.Primitives;
namespace Microsoft.AspNet.TestHost
{
@ -16,7 +17,7 @@ namespace Microsoft.AspNet.TestHost
public ResponseFeature()
{
Headers = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase);
Headers = new Dictionary<string, StringValues>(StringComparer.OrdinalIgnoreCase);
Body = new MemoryStream();
// 200 is the default status code all the way down to the host, so we set it
@ -28,7 +29,7 @@ namespace Microsoft.AspNet.TestHost
public string ReasonPhrase { get; set; }
public IDictionary<string, string[]> Headers { get; set; }
public IDictionary<string, StringValues> Headers { get; set; }
public Stream Body { get; set; }