Skip to content

Commit f4f698a

Browse files
committed
Use ConcurrentQueue in test to handle concurrent requests
1 parent a355d98 commit f4f698a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/ModelContextProtocol.AspNetCore.Tests/MapMcpStreamableHttpTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Microsoft.Extensions.DependencyInjection;
33
using Microsoft.Extensions.Primitives;
44
using ModelContextProtocol.Client;
5+
using System.Collections.Concurrent;
56

67
namespace ModelContextProtocol.AspNetCore.Tests;
78

@@ -148,7 +149,7 @@ public async Task SseMode_Works_WithSseEndpoint()
148149
[Fact]
149150
public async Task StreamableHttpClient_SendsMcpProtocolVersionHeader_AfterInitialization()
150151
{
151-
var protocolVersionHeaderValues = new List<string?>();
152+
var protocolVersionHeaderValues = new ConcurrentQueue<string?>();
152153

153154
Builder.Services.AddMcpServer().WithHttpTransport(ConfigureStateless).WithTools<EchoHttpContextUserTools>();
154155

@@ -160,7 +161,7 @@ public async Task StreamableHttpClient_SendsMcpProtocolVersionHeader_AfterInitia
160161
{
161162
if (!StringValues.IsNullOrEmpty(context.Request.Headers["mcp-protocol-version"]))
162163
{
163-
protocolVersionHeaderValues.Add(context.Request.Headers["mcp-protocol-version"]);
164+
protocolVersionHeaderValues.Enqueue(context.Request.Headers["mcp-protocol-version"]);
164165
}
165166

166167
await next(context);

0 commit comments

Comments
 (0)