Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Sources/MCP/Base/Transports/HTTPServer/HTTPServerTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,18 @@ package enum JSONRPCMessageKind: Decodable {
self = decoded
}

/// The error for data that could not be classified as a JSON-RPC message.
static func classificationError(for data: Data) -> MCPError {
// JSON-RPC 2.0 §5.1 reserves -32700 for invalid JSON. Scalars and arrays
// are valid JSON, but are not single messages on the HTTP transport.
do {
_ = try JSONSerialization.jsonObject(with: data, options: [.fragmentsAllowed])
return .invalidRequest("Invalid JSON-RPC message")
} catch {
return .parseError("Invalid JSON-RPC message")
}
}

/// Classifies a JSON-RPC object.
///
/// A message with a string `method` is a request when it has an `id`
Expand All @@ -433,6 +445,11 @@ package enum JSONRPCMessageKind: Decodable {
self = .invalid(method: method, id: nil, reason: reason)
}
} else if container.contains(.result) || container.contains(.error), let id {
// JSON-RPC 2.0 §5 requires the version on responses too.
guard (try? container.decode(String.self, forKey: .jsonrpc)) == "2.0" else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem
P2: JSONRPCMessageKind is also the client's classifier. HTTPClientTransport.processSSE uses case .response(let id) = JSONRPCMessageKind(data: data) (HTTPClientTransport.swift:1407-1411) to detect the awaited response and cancel the POST stream. With this guard, an SSE response without "jsonrpc": "2.0" is no longer recognized. responded stays false, so the transport keeps reading, then runs resumeResponseStream (GET with Last-Event-ID, up to maxStreamResumptions) or deliverStreamLoss for a request the Client has already failed. The PR describes the change as server-side and adds no client test.

Why this is needed: Against a non-conforming server the client now holds the POST stream open and can make several reconnect requests after the caller already has its error, then yields a second error that Client drops. The caller does not hang, so the impact is limited, but the client behavior changed without a test or a note in the PR description, and a later edit to the shared classifier can change it again unnoticed.

Evidence

// Sources/MCP/Base/Transports/HTTPServer/HTTPServerTypes.swift:447-452
} else if container.contains(.result) || container.contains(.error), let id {
    // JSON-RPC 2.0 §5 requires the version on responses too.
    guard (try? container.decode(String.self, forKey: .jsonrpc)) == "2.0" else {
        throw DecodingError.dataCorruptedError(
            forKey: .jsonrpc, in: container, debugDescription: InvalidRequestReason.jsonrpc)
    }

Required change
Add a client test next to "Receive Server-Sent Event (SSE)" (HTTPClientTransportTests.swift:1032) that pins the intended outcome, for example:

@Test("An SSE response without jsonrpc 2.0 ends the POST stream", .httpClientTransportSetup)
func sseResponseWithoutVersion() async throws {
    // Serve the POST with Content-Type: text/event-stream and one event:
    //   data: {"id":<awaited id>,"result":{}}
    // Expect: the transport yields the event once, sends no resumption GET,
    // and yields no second error for that id (or whatever outcome is chosen).
}

Alternatively, give the client its own routing check (id plus result/error) and keep the version check in the server POST path. Either way, mention the client effect in the PR description.

not single-hunk: needs a new test in Tests/MCPTests/HTTPClientTransportTests.swift

throw DecodingError.dataCorruptedError(
forKey: .jsonrpc, in: container, debugDescription: InvalidRequestReason.jsonrpc)
}
self = .response(id: id.description)
} else {
throw DecodingError.dataCorrupted(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public actor StatefulHTTPServerTransport: Transport, HTTPContextProviding {
guard let messageKind = JSONRPCMessageKind(data: body) else {
return .error(
statusCode: 400,
.parseError("Invalid JSON-RPC message"),
JSONRPCMessageKind.classificationError(for: body),
sessionID: sessionID
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public actor StatelessHTTPServerTransport: Transport, HTTPContextProviding {
let normalized = try? JSONSerialization.data(withJSONObject: json, options: [.withoutEscapingSlashes]),
let messageKind = JSONRPCMessageKind(data: normalized)
else {
return .error(statusCode: 400, .parseError("Invalid JSON-RPC message"))
return .error(statusCode: 400, JSONRPCMessageKind.classificationError(for: body))
}

// One probe for the id and the `_meta` version.
Expand Down
22 changes: 13 additions & 9 deletions Sources/MCP/Server/Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,6 @@ public actor Server {
for try await data in stream {
if Task.isCancelled { break } // Check cancellation inside loop

var requestID: ID?
do {
// Attempt to decode as batch first, then as individual response, request, or notification
if let batch = try? decoder.decode(Server.Batch.self, from: data) {
Expand Down Expand Up @@ -557,6 +556,7 @@ public actor Server {
try await handleMessage(message)
} else {
// Try to extract request ID from raw JSON if possible
var requestID: ID?
if let json = try? decoder.decode(
[String: Value].self, from: data),
let idValue = json["id"]
Comment on lines 560 to 562

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem
P2: on stdio, in-memory and Network transports, a single malformed response such as {"id":5,"result":{}} or {"jsonrpc":"1.0","id":5,"error":{...}} now fails the new jsonrpc guard, reaches this fallback, and is answered with {"jsonrpc":"2.0","id":5,"error":{"code":-32600}}. The same input inside a batch is answered with "id": null (Server.swift:3024). The new rows at Tests/MCPTests/RequestLifecycleTests.swift:615-616 expect id 5, while batchInvalidResponseVersion expects null.

Why this is needed: The id of a response names one of this server's own requests, which is the reason the batch path nulls it. The peer matches replies by id, so it can read this -32600 as the answer to its own request 5 and fail an unrelated call; peers that number requests 0, 1, 2 are the ones exposed. The attribution existed before (with -32700), but this PR rewrites the branch and its tests now lock in the variant the batch comment calls wrong.

Evidence

// Sources/MCP/Server/Server.swift:560-572
if let json = try? decoder.decode(
    [String: Value].self, from: data),
    let idValue = json["id"]
{ ... }
let error = JSONRPCMessageKind.classificationError(for: data)
if let requestID {
    try? await send(AnyMethod.response(id: requestID, error: error))

Required change

 if let json = try? decoder.decode(
     [String: Value].self, from: data),
+    json["result"] == nil, json["error"] == nil,
     let idValue = json["id"]

and in Tests/MCPTests/RequestLifecycleTests.swift:615-616:

-    (#"{"id":5,"result":{}}"#, -32600, 5),
-    (#"{"jsonrpc":"1.0","id":5,"error":{"code":-32603,"message":"failed"}}"#, -32600, 5),
+    (#"{"id":5,"result":{}}"#, -32600, .null),
+    (#"{"jsonrpc":"1.0","id":5,"error":{"code":-32603,"message":"failed"}}"#, -32600, .null),
Suggested change
if let json = try? decoder.decode(
[String: Value].self, from: data),
let idValue = json["id"]
if let json = try? decoder.decode(
[String: Value].self, from: data),
json["result"] == nil, json["error"] == nil,
let idValue = json["id"]

Expand All @@ -567,7 +567,12 @@ public actor Server {
requestID = .number(intValue)
}
}
throw MCPError.parseError("Invalid message format")
let error = JSONRPCMessageKind.classificationError(for: data)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem
P3: before this PR an unreadable message was thrown into the catch block, which logged "Error processing message". It is now answered inline and never reaches the catch, so it leaves no server log entry. A failed reply on the id path is also swallowed by try?.

Why this is needed: Server reports failed message handling through logger. An operator debugging a client that sends bad input over stdio loses the only server-side trace of it, since the -32700 or -32600 goes to the peer only.

Evidence

// Sources/MCP/Server/Server.swift:570-575
let error = JSONRPCMessageKind.classificationError(for: data)
if let requestID {
    try? await send(AnyMethod.response(id: requestID, error: error))
} else {
    await sendUnattributedError(error)
}

Required change

let error = JSONRPCMessageKind.classificationError(for: data)
await logger?.warning("Invalid message", metadata: ["error": "\(error)"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem
P3: on the rejection path the loop has already decoded the body as Batch, AnyResponse, AnyRequest, JSONRPCMessageKind, AnyMessage and [String: Value]. When the [String: Value] decode succeeded, the body is known to be JSON, yet classificationError(for:) parses it again with JSONSerialization. StatelessHTTPServerTransport.handlePost re-parses the same way. The valid path is unchanged.

Why this is needed: The cost is linear and only on rejected input, but a peer can trigger it at will on a path that already parses each rejected message six times.

Evidence

// Sources/MCP/Server/Server.swift:570
let error = JSONRPCMessageKind.classificationError(for: data)

Required change

let object = try? decoder.decode([String: Value].self, from: data)
// ... extract requestID from `object` as today ...
let error: MCPError = object != nil
    ? .invalidRequest("Invalid JSON-RPC message")
    : JSONRPCMessageKind.classificationError(for: data)

if let requestID {
try? await send(AnyMethod.response(id: requestID, error: error))
} else {
await sendUnattributedError(error)
}
}
} catch let error where MCPError.isResourceTemporarilyUnavailable(error) {
// Resource temporarily unavailable, retry after a short delay
Expand All @@ -578,9 +583,7 @@ public actor Server {
"Error processing message", metadata: ["error": "\(error)"])
let mcpError =
error as? MCPError ?? MCPError.internalError(error.localizedDescription)
if let requestID {
try? await send(AnyMethod.response(id: requestID, error: mcpError))
} else if case .parseError = mcpError {
if case .parseError = mcpError {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem
P3: the PR removed throw MCPError.parseError("Invalid message format"), the only source of .parseError in this do block. The remaining throwing call, handleMessage, catches handler errors and never throws .parseError, so this branch and its comment describe a path that is no longer reached.

Why this is needed: A reader looking for where unreadable messages are answered lands here instead of at line 570, and code that looks live but is not invites wrong edits later.

Evidence

// Sources/MCP/Server/Server.swift:586-590
if case .parseError = mcpError {
    // A message that could not be read: `"id": null`.
    await sendUnattributedError(mcpError)
}
// Notifications are never answered.

Required change

-                        let mcpError =
-                            error as? MCPError ?? MCPError.internalError(error.localizedDescription)
-                        if case .parseError = mcpError {
-                            // A message that could not be read: `"id": null`.
-                            await sendUnattributedError(mcpError)
-                        }
-                        // Notifications are never answered.
+                        // Unreadable messages are answered above; errors from
+                        // notification handling are only logged.

// A message that could not be read: `"id": null`.
await sendUnattributedError(mcpError)
}
Expand Down Expand Up @@ -2976,7 +2979,7 @@ extension Server.Batch: Decodable {

extension Server.Batch.Item: Decodable {
private enum CodingKeys: String, CodingKey {
case id
case id, result, error
}

/// Classifies an item as ``JSONRPCMessageKind`` does for a single
Expand Down Expand Up @@ -3016,9 +3019,10 @@ extension Server.Batch.Item: Decodable {
self = .invalid(id: nil, reason: format)
}
case nil:
// No string `method`, and no `result` or `error` with a valid
// `id`, such as `{"jsonrpc": "2.0", "id": 7}`.
self = .invalid(id: id, reason: format)
// An unreadable response still names this server's request,
// even when its version prevents classification as a response.
let isResponse = container.contains(.result) || container.contains(.error)
self = .invalid(id: isResponse ? nil : id, reason: format)
Comment on lines +3022 to +3025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem
P3: read on its own, "An unreadable response still names this server's request" suggests the id is kept, but the next line drops it. The reason is in the type's doc comment above, not here.

Why this is needed: A maintainer reading only this branch may "fix" it to keep the id, which would reintroduce the attribution this change removes.

Evidence

// Sources/MCP/Server/Server.swift:3022-3025
// An unreadable response still names this server's request,
// even when its version prevents classification as a response.
let isResponse = container.contains(.result) || container.contains(.error)
self = .invalid(id: isResponse ? nil : id, reason: format)

Required change

Suggested change
// An unreadable response still names this server's request,
// even when its version prevents classification as a response.
let isResponse = container.contains(.result) || container.contains(.error)
self = .invalid(id: isResponse ? nil : id, reason: format)
// A response's `id` names a request of this server, not one of
// the peer: an unreadable one is answered with `"id": null`.
let isResponse = container.contains(.result) || container.contains(.error)
self = .invalid(id: isResponse ? nil : id, reason: format)

}
}
}
92 changes: 86 additions & 6 deletions Tests/MCPTests/HTTPServerTransportTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,39 @@ private func makeStatelessTransport() -> StatelessHTTPServerTransport {
)
}

private let invalidMessageBodies: [(String, Int)] = [
(#"{"not_a_valid_request":true}"#, -32600),
(#"{"jsonrpc":"2.0","id":7}"#, -32600),
(#"{"jsonrpc":"2.0","id":"request"}"#, -32600),
(#"{"jsonrpc":"2.0","method":42}"#, -32600),
(#"{"id":1,"result":{}}"#, -32600),
(#"{"jsonrpc":"1.0","id":1,"result":{}}"#, -32600),
(#"{"jsonrpc":null,"id":1,"result":{}}"#, -32600),
(#"{"jsonrpc":2.0,"id":1,"result":{}}"#, -32600),
(#"{"id":"r","error":{"code":-32603,"message":"failed"}}"#, -32600),
(#"{"jsonrpc":"1.0","id":"r","error":{"code":-32603,"message":"failed"}}"#, -32600),
("{}", -32600),
("[]", -32600),
("[1,2,3]", -32600),
(#"[{"jsonrpc":"2.0","id":1,"method":"ping"}]"#, -32600),
("null", -32600),
("true", -32600),
("false", -32600),
("42", -32600),
("1.5", -32600),
(#""text""#, -32600),
("not valid json{", -32700),
(#"{"jsonrpc":"2.0","id":7"#, -32700),
("[1,", -32700),
("true false", -32700),
(" \n\t", -32700),
]

private let validResponseBodies = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem
P3: no test covers a valid JSON-RPC error response with "id": null, which a client sends when it could not read a server request (JSON-RPC 2.0 §5). JSONRPCMessageKind maps a null id to nil, so the body is rejected and now gets 400 with -32600 (before: -32700).

Why this is needed: This is the boundary input most likely to be misclassified, and today neither table records whether it should be accepted (202) or rejected. A change in either direction would pass the suite.

Evidence

// Tests/MCPTests/HTTPServerTransportTests.swift:163-166
private let validResponseBodies = [
    #"{"jsonrpc":"2.0","id":1,"result":{}}"#,
    #"{"jsonrpc":"2.0","id":"r","error":{"code":-32603,"message":"failed"}}"#,
]

Required change

// Add to invalidMessageBodies if rejection is intended (with a comment),
// or to validResponseBodies if it should be accepted with 202:
(#"{"jsonrpc":"2.0","id":null,"error":{"code":-32700,"message":"x"}}"#, -32600),

#"{"jsonrpc":"2.0","id":1,"result":{}}"#,
#"{"jsonrpc":"2.0","id":"r","error":{"code":-32603,"message":"failed"}}"#,
]

/// Drains an SSE stream, collecting raw SSE chunks.
private actor ChunkCollector {
var chunks: [Data] = []
Expand Down Expand Up @@ -814,17 +847,36 @@ struct StatefulHTTPServerTransportTests {
await transport.disconnect()
}

@Test("Invalid JSON body returns 400")
func testInvalidJSONReturns400() async throws {
@Test("Invalid bodies return the appropriate JSON-RPC error", arguments: invalidMessageBodies.indices)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem
P3: the three parameterized tests run over .indices, so cases are reported as 0 to 24 (50 for the stateless variant, which also crosses two versions). A failure has to be mapped back to the table by hand.

Why this is needed: It slows down diagnosis when one row regresses. The pattern already exists in RequestIDValidationTests, so this is a minor consistency trade-off.

Evidence

// Tests/MCPTests/HTTPServerTransportTests.swift:850
@Test("Invalid bodies return the appropriate JSON-RPC error", arguments: invalidMessageBodies.indices)

Required change

@Test("Invalid bodies return the appropriate JSON-RPC error", arguments: invalidMessageBodies)
func testInvalidBodyErrorCode(_ body: String, _ expectedCode: Int) async throws {

func testInvalidBodyErrorCode(_ index: Int) async throws {
let (body, expectedCode) = invalidMessageBodies[index]
let transport = makeStatefulTransport()
let sessionID = try await initializeSession(transport: transport)

let response = await transport.handleRequest(
makeStatefulPOSTRequest(body: Data("not json".utf8), sessionID: sessionID)
makeStatefulPOSTRequest(body: Data(body.utf8), sessionID: sessionID)
)
await transport.disconnect()

#expect(response.statusCode == 400)
#expect(response.headers[HTTPHeaderName.sessionID] == sessionID)
#expect(response.headers[HTTPHeaderName.contentType] == "application/json")
let data = try #require(response.bodyData)
let json = try JSONDecoder().decode(Value.self, from: data)
expectWire(json, matches: ["jsonrpc": "2.0", "id": .null, "error": ["code": .int(expectedCode)]])
}

@Test("Valid JSON-RPC responses are still accepted", arguments: validResponseBodies)
func testValidResponseAccepted(_ body: String) async throws {
let transport = makeStatefulTransport()
let sessionID = try await initializeSession(transport: transport)
let response = await transport.handleRequest(
makeStatefulPOSTRequest(body: Data(body.utf8), sessionID: sessionID))
await transport.disconnect()

#expect(response.statusCode == 202)
#expect(response.bodyData == nil)
#expect(response.headers[HTTPHeaderName.sessionID] == sessionID)
}

// MARK: - OAuth Bearer Validation
Expand Down Expand Up @@ -1409,17 +1461,45 @@ struct StatelessHTTPServerTransportTests {
await transport.disconnect()
}

@Test("Invalid JSON body returns 400")
func testInvalidJSONReturns400() async throws {
@Test(
"Invalid bodies return the appropriate JSON-RPC error in both protocol eras",
arguments: invalidMessageBodies.indices, [Version.v2025_11_25, Version.v2026_07_28]
)
func testInvalidBodyErrorCode(_ index: Int, protocolVersion: String) async throws {
let (body, expectedCode) = invalidMessageBodies[index]
let transport = makeStatelessTransport()
try await transport.connect()

let response = await transport.handleRequest(
makeStatelessPOSTRequest(body: Data("not json".utf8))
HTTPRequest(
method: "POST",
headers: [
HTTPHeaderName.contentType: "application/json",
HTTPHeaderName.accept: "application/json",
HTTPHeaderName.protocolVersion: protocolVersion,
],
body: Data(body.utf8))
)
await transport.disconnect()

#expect(response.statusCode == 400)
#expect(response.headers[HTTPHeaderName.sessionID] == nil)
#expect(response.headers[HTTPHeaderName.contentType] == "application/json")
let data = try #require(response.bodyData)
let json = try JSONDecoder().decode(Value.self, from: data)
expectWire(json, matches: ["jsonrpc": "2.0", "id": .null, "error": ["code": .int(expectedCode)]])
}

@Test("Valid JSON-RPC responses are still accepted", arguments: validResponseBodies)
func testValidResponseAccepted(_ body: String) async throws {
let transport = makeStatelessTransport()
try await transport.connect()
let response = await transport.handleRequest(
makeStatelessPOSTRequest(body: Data(body.utf8)))
await transport.disconnect()

#expect(response.statusCode == 202)
#expect(response.bodyData == nil)
}

// MARK: - Terminated State
Expand Down
18 changes: 18 additions & 0 deletions Tests/MCPTests/RequestIDValidationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,24 @@ struct StreamRequestIDTests {
#expect(try await replies(to: batch, expected: 0).isEmpty)
}

@Test(
"An invalid response version in a batch is not attributed to the peer's request",
arguments: [
#"{"id":5,"result":{}}"#,
#"{"jsonrpc":"1.0","id":"r","error":{"code":-32603,"message":"failed"}}"#,
])
func batchInvalidResponseVersion(_ response: String) async throws {
let batch = "[\(response)," + #"{"jsonrpc":"2.0","id":2,"method":"tools/list"}]"#
let replies = try await replies(to: batch)
let items = try #require(replies.first?.arrayValue)
#expect(items.count == 2)
expectWire(
try #require(items.first),
matches: ["jsonrpc": "2.0", "id": .null, "error": ["code": -32600]])
#expect(items.last?.objectValue?["id"] == 2)
#expect(items.last?.objectValue?["result"] != nil)
}

@Test("A response in a batch answers the server's pending request")
@available(*, deprecated, message: "listRoots is deprecated by SEP-2577")
func batchedResponseResumesRequest() async throws {
Expand Down
41 changes: 36 additions & 5 deletions Tests/MCPTests/RequestLifecycleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,23 @@ struct BatchTests {
}
}

private let invalidStreamMessages: [(String, Int, Value)] = [
(#"{"jsonrpc":"2.0","bogus":true}"#, -32600, .null),
(#"{"not_a_valid_request":true}"#, -32600, .null),
(#"{"jsonrpc":"2.0","id":7}"#, -32600, 7),
(#"{"id":5,"result":{}}"#, -32600, 5),
(#"{"jsonrpc":"1.0","id":5,"error":{"code":-32603,"message":"failed"}}"#, -32600, 5),
("{}", -32600, .null),
("null", -32600, .null),
("true", -32600, .null),
("42", -32600, .null),
(#""text""#, -32600, .null),
("not valid json{", -32700, .null),
(#"{"jsonrpc":"2.0","id":7"#, -32700, .null),
("[1,", -32700, .null),
("true false", -32700, .null),
]

@Suite("Server replies", .timeLimit(.minutes(1)))
struct ServerReplyTests {
/// Sends raw lines to a started server; returns what it sent back
Expand Down Expand Up @@ -673,13 +690,27 @@ struct ServerReplyTests {
await server.stop()
}

@Test("A message that cannot be read is answered with a null id")
func unreadableMessage() async throws {
@Test("Invalid stream messages distinguish syntax from message errors", arguments: invalidStreamMessages.indices)
func unreadableMessage(_ index: Int) async throws {
let (body, expectedCode, expectedID) = invalidStreamMessages[index]
let server = await makeServer()
let replies = try await exchange(server, [#"{"jsonrpc":"2.0","bogus":true}"#])
let (clientEnd, serverEnd) = await InMemoryTransport.createConnectedPair()
let peer = RawPeer(clientEnd)
try await server.start(transport: serverEnd)
try await peer.start()
try await peer.send(body)
// Valid notifications and responses must still get no reply.
try await peer.send(#"{"jsonrpc":"2.0","method":"notifications/vendor"}"#)
try await peer.send(#"{"jsonrpc":"2.0","id":"response","result":{}}"#)
try await peer.sync("sentinel")
let replies = await peer.received.filter { $0.objectValue?["id"] != "sentinel" }
await peer.stop()
await server.stop()

#expect(replies.count == 1)
#expect(replies.first?.objectValue?["id"] == .null)
#expect(replies.first?.objectValue?["error"]?.objectValue?["code"] == -32700)
expectWire(
try #require(replies.first),
matches: ["jsonrpc": "2.0", "id": expectedID, "error": ["code": .int(expectedCode)]])
}

@Test("An empty batch is answered with a null id")
Expand Down
Loading