toJSON converts the request to a JSON string
(t *testing.T)
| 338 | |
| 339 | // toJSON converts the request to a JSON string |
| 340 | func (r *testRequest) toJSON(t *testing.T) string { |
| 341 | t.Helper() |
| 342 | |
| 343 | reqData := map[string]interface{}{ |
| 344 | "id": r.ID, |
| 345 | "method": r.Method, |
| 346 | } |
| 347 | if r.Params != nil { |
| 348 | reqData["params"] = r.Params |
| 349 | } |
| 350 | |
| 351 | jsonBytes, err := json.Marshal(reqData) |
| 352 | if err != nil { |
| 353 | t.Fatalf("Failed to marshal request: %v", err) |
| 354 | } |
| 355 | return string(jsonBytes) |
| 356 | } |
| 357 | |
| 358 | // executeRequest is a helper that sends a JSON-RPC request and returns the parsed response |
| 359 | func executeRequest(t *testing.T, s *server, request string) map[string]interface{} { |
no outgoing calls
no test coverage detected