mcp: refactor the streamable client test to be more flexible
Use a fake streamable server to facilitate testing client behavior. For this commit, just update the existing test (moved to a new file for isolation). Subsequent CLs will add more tests. Improve one client error message that occurred while debuging tests. For #393
This commit is contained in:
parent
30261728f7
commit
a4313f92bf
1 changed files with 193 additions and 72 deletions
|
|
@ -1234,7 +1234,14 @@ func (c *streamableClientConn) Write(ctx context.Context, msg jsonrpc.Message) e
|
|||
|
||||
default:
|
||||
resp.Body.Close()
|
||||
return fmt.Errorf("unsupported content type %q", ct)
|
||||
switch msg := msg.(type) {
|
||||
case *jsonrpc.Request:
|
||||
return fmt.Errorf("unsupported content type %q when sending %q (status: %d)", ct, msg.Method, resp.StatusCode)
|
||||
case *jsonrpc.Response:
|
||||
return fmt.Errorf("unsupported content type %q when sending jsonrpc response #%d (status: %d)", ct, msg.ID, resp.StatusCode)
|
||||
default:
|
||||
panic("unreachable")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue