Remove value span usage (#12990)
This commit is contained in:
parent
4144eeb459
commit
3d9311a29f
|
|
@ -222,13 +222,11 @@ namespace Microsoft.AspNetCore.Http.Connections
|
||||||
switch (reader.TokenType)
|
switch (reader.TokenType)
|
||||||
{
|
{
|
||||||
case JsonTokenType.PropertyName:
|
case JsonTokenType.PropertyName:
|
||||||
var memberName = reader.ValueSpan;
|
if (reader.ValueTextEquals(TransportPropertyNameBytes.EncodedUtf8Bytes))
|
||||||
|
|
||||||
if (memberName.SequenceEqual(TransportPropertyNameBytes.EncodedUtf8Bytes))
|
|
||||||
{
|
{
|
||||||
availableTransport.Transport = reader.ReadAsString(TransportPropertyName);
|
availableTransport.Transport = reader.ReadAsString(TransportPropertyName);
|
||||||
}
|
}
|
||||||
else if (memberName.SequenceEqual(TransferFormatsPropertyNameBytes.EncodedUtf8Bytes))
|
else if (reader.ValueTextEquals(TransferFormatsPropertyNameBytes.EncodedUtf8Bytes))
|
||||||
{
|
{
|
||||||
reader.CheckRead();
|
reader.CheckRead();
|
||||||
reader.EnsureArrayStart();
|
reader.EnsureArrayStart();
|
||||||
|
|
|
||||||
|
|
@ -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\"}", null, null, "http://foo.com/chat", null)]
|
||||||
[InlineData("{\"url\": \"http://foo.com/chat\", \"accessToken\": \"token\"}", null, null, "http://foo.com/chat", "token")]
|
[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\":[{\"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)
|
public void ParsingNegotiateResponseMessageSuccessForValid(string json, string connectionId, string[] availableTransports, string url, string accessToken)
|
||||||
{
|
{
|
||||||
var responseData = Encoding.UTF8.GetBytes(json);
|
var responseData = Encoding.UTF8.GetBytes(json);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue