MCPcopy Create free account
hub / github.com/astercloud/aster / TestServer_HandleRequest_InvalidParams

Function TestServer_HandleRequest_InvalidParams

pkg/a2a/server_test.go:261–282  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

259}
260
261func TestServer_HandleRequest_InvalidParams(t *testing.T) {
262 system := actor.NewSystem("test-a2a")
263 defer system.Shutdown()
264
265 taskStore := NewInMemoryTaskStore()
266 server := NewServer(system, taskStore)
267
268 // 无效的参数
269 req := &JSONRPCRequest{
270 JSONRPC: "2.0",
271 ID: "req-1",
272 Method: "message/send",
273 Params: []byte("invalid json"),
274 }
275
276 ctx := context.Background()
277 resp := server.HandleRequest(ctx, "agent-1", req)
278
279 require.NotNil(t, resp)
280 assert.NotNil(t, resp.Error)
281 assert.Equal(t, ErrorCodeInvalidParams, resp.Error.Code)
282}
283
284func TestJSONRPCError(t *testing.T) {
285 // 测试错误响应的创建

Callers

nothing calls this directly

Calls 5

ShutdownMethod · 0.95
HandleRequestMethod · 0.95
NewSystemFunction · 0.92
NewInMemoryTaskStoreFunction · 0.85
NewServerFunction · 0.85

Tested by

no test coverage detected