Remove value span usage (#12990)

This commit is contained in:
Brennan 2019-08-15 14:09:05 -07:00 committed by GitHub
parent 4144eeb459
commit 3d9311a29f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -222,13 +222,11 @@ namespace Microsoft.AspNetCore.Http.Connections
switch (reader.TokenType)
{
case JsonTokenType.PropertyName:
var memberName = reader.ValueSpan;
if (memberName.SequenceEqual(TransportPropertyNameBytes.EncodedUtf8Bytes))
if (reader.ValueTextEquals(TransportPropertyNameBytes.EncodedUtf8Bytes))
{
availableTransport.Transport = reader.ReadAsString(TransportPropertyName);
}
else if (memberName.SequenceEqual(TransferFormatsPropertyNameBytes.EncodedUtf8Bytes))
else if (reader.ValueTextEquals(TransferFormatsPropertyNameBytes.EncodedUtf8Bytes))
{
reader.CheckRead();
reader.EnsureArrayStart();

View File

@ -18,6 +18,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
[InlineData("{\"url\": \"http://foo.com/chat\"}", null, null, "http://foo.com/chat", null)]
[InlineData("{\"url\": \"http://foo.com/chat\", \"accessToken\": \"token\"}", null, null, "http://foo.com/chat", "token")]
[InlineData("{\"connectionId\":\"123\",\"availableTransports\":[{\"transport\":\"test\",\"transferFormats\":[]}]}", "123", new[] { "test" }, null, null)]
[InlineData("{\"connectionId\":\"123\",\"availableTransports\":[{\"\\u0074ransport\":\"test\",\"transferFormats\":[]}]}", "123", new[] { "test" }, null, null)]
public void ParsingNegotiateResponseMessageSuccessForValid(string json, string connectionId, string[] availableTransports, string url, string accessToken)
{
var responseData = Encoding.UTF8.GetBytes(json);