MCPcopy Create free account
hub / github.com/asternic/wuzapi / executeRequest

Function executeRequest

stdio_test.go:359–376  ·  view source on GitHub ↗

executeRequest is a helper that sends a JSON-RPC request and returns the parsed response

(t *testing.T, s *server, request string)

Source from the content-addressed store, hash-verified

357
358// executeRequest is a helper that sends a JSON-RPC request and returns the parsed response
359func executeRequest(t *testing.T, s *server, request string) map[string]interface{} {
360 t.Helper()
361
362 stdin := bytes.NewBufferString(request + "\n")
363 stdout := &bytes.Buffer{}
364
365 stdioServer := newStdioServerWithIO(s, stdin, stdout)
366 if err := stdioServer.Start(); err != nil {
367 t.Fatalf("Start() failed: %v", err)
368 }
369
370 var response map[string]interface{}
371 if err := json.Unmarshal(stdout.Bytes(), &response); err != nil {
372 t.Fatalf("Failed to parse response:\n%s\nError: %v", stdout.String(), err)
373 }
374
375 return response
376}
377
378func makeTestServer(t *testing.T) *server {
379 t.Helper()

Callers 15

TestStdioHealthRequestFunction · 0.85
TestAdminUsersAddAndListFunction · 0.85
TestAdminUsersGetFunction · 0.85
TestAdminUsersDeleteFunction · 0.85
TestSessionStatusFunction · 0.85
TestChatSendTextFunction · 0.85
TestChatHistoryFunction · 0.85
TestWebhookUpdateFunction · 0.85
TestWebhookSetFunction · 0.85
TestWebhookDeleteFunction · 0.85
TestNumericRequestIDFunction · 0.85
TestNumericZeroRequestIDFunction · 0.85

Calls 3

newStdioServerWithIOFunction · 0.85
StartMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected