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:
parent
3e628db6d8
commit
6f1f65a392
1 changed files with 206 additions and 25 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue