missingResponse is what gh gets for a request with no stored response. Its message names the request so the caller knows what to add.
(name string, isGraphQL bool)
| 326 | // missingResponse is what gh gets for a request with no stored response. Its |
| 327 | // message names the request so the caller knows what to add. |
| 328 | func missingResponse(name string, isGraphQL bool) (int, any) { |
| 329 | msg := "ghmock: no response for " + name |
| 330 | if isGraphQL { |
| 331 | return http.StatusOK, map[string]any{"errors": []map[string]string{{"message": msg}}} |
| 332 | } |
| 333 | return http.StatusNotFound, map[string]string{"message": msg} |
| 334 | } |
| 335 | |
| 336 | func writeJSON(w http.ResponseWriter, status int, payload any) { |
| 337 | w.Header().Set("Content-Type", "application/json; charset=utf-8") |