Allow params field to be omitted in requests for methods that don't require them (#17)

* Allow `params` field to be omitted in requests for methods with empty parameters

* Add ping request to roundtrip test

* Generalize decoding of non-required parameters
This commit is contained in:
Mattt 2025-03-17 05:26:47 -07:00 • committed by GitHub
commit 6f1f65a392
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -118,6 +118,26 @@ struct RoundtripTests {
group.cancelAll()
}
// Test ping
let pingTask = Task {
try await client.ping()
// Ping doesn't return anything, so just getting here without throwing is success
#expect(true) // Test passed if we reach this point
}
try await withThrowingTaskGroup(of: Void.self) { group in
group.addTask {
try await Task.sleep(for: .seconds(1))
pingTask.cancel()
throw CancellationError()
}
group.addTask {
try await pingTask.value
}
try await group.next()
group.cancelAll()
}
let listToolsTask = Task {
let result = try await client.listTools()
#expect(result.count == 1)