MCPcopy Index your code
hub / github.com/github/github-mcp-server / TestReadJSONRPCResponse_ServerError

Function TestReadJSONRPCResponse_ServerError

cmd/mcpcurl/main_test.go:91–106  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

89}
90
91func TestReadJSONRPCResponse_ServerError(t *testing.T) {
92 t.Parallel()
93 input := `{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"method not found"}}` + "\n"
94 scanner := bufio.NewScanner(strings.NewReader(input))
95
96 _, err := readJSONRPCResponse(scanner)
97 if err == nil {
98 t.Fatal("expected error for server error response, got nil")
99 }
100 if !strings.Contains(err.Error(), "server returned error") {
101 t.Fatalf("expected 'server returned error', got: %v", err)
102 }
103 if !strings.Contains(err.Error(), "method not found") {
104 t.Fatalf("expected error to contain server message, got: %v", err)
105 }
106}
107
108func TestBuildInitializeRequest(t *testing.T) {
109 t.Parallel()

Callers

nothing calls this directly

Calls 2

readJSONRPCResponseFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected