(path string, status int, res string)
| 338 | } |
| 339 | |
| 340 | func mockQueryResponse(path string, status int, res string) http.HandlerFunc { |
| 341 | return func(w http.ResponseWriter, r *http.Request) { |
| 342 | // Ensure the path is the expected one. |
| 343 | if r.URL.Path != path { |
| 344 | w.WriteHeader(http.StatusNotFound) |
| 345 | return |
| 346 | } |
| 347 | |
| 348 | // Send back the mocked response. |
| 349 | w.WriteHeader(status) |
| 350 | if status == http.StatusOK { |
| 351 | _, _ = w.Write([]byte(res)) |
| 352 | } |
| 353 | } |
| 354 | } |
no test coverage detected